I am trying to create a batch file to control various things on my tape library. I need to get the output of this command into variables to be used later in my batch file.
The command is:
rsm view /tphysical_media /guiddisplay /b
And the output is 7 GUIDs that can change every time I add a tape to the library. The output now is:
<< blank line >>
44519C3DB47049319158A22BC2936143
CDA50F31773143499B4E9AE2ECC965BD
D65B80646F594AA9BE247909B7396197
801387E8AC574B288A5A553130E46A5B
11662170187945F7B9CA75F54863A7E1
266A95DE022140D1BC71684A385A6B19
94A245DA463E4A5FB1E47786CA691F8F
I need skip the first blank line and loop through this output and assign each of these 7 items to a variable (Like Tape1, Tape2, Tape3, etc.).
Loop through output of command and assign each a variable
Moderator: DosItHelp
Re: Loop through output of command and assign each a variabl
Code: Select all
@echo off
setlocal enableextensions
set /a cnt=0
for /f %%s in ('rsm view /tphysical_media /guiddisplay /b') do (
set /a cnt+=1
call set Tape%%cnt%%=%%s
)
set Tape
pause