M
Mike Celone
I have a batch file that uses a FOR loop to read workstation names from a
text file and executes a series of commands. Right now it uses 5 seperate
FOR loops to read the same file and execute the other commands. The first
one creates the directory on the machine, the 2nd copies the files to the
machines, 3rd runs the program, 4th deletes the files, and the 5th reboots
the machine. Here's the batch file:
FOR /F "delims=\, " %%j in (F:\iseries\workstations.txt) do md
\\%%j\c$\temp\iseries
FOR /F "delims=\, " %%i in (F:\iseries\workstations.txt) do copy
\\server\iseries\*.* \\%%i\c$\temp\iseries
FOR /F "delims=\, " %%g in (F:\iseries\workstations.txt) do psexec \\%%g
c:\temp\iseries\setup.exe
FOR /F "delims=\, " %%h in (F:\iseries\workstations.txt) do del
\\%%h\c$\temp\iseries /q
FOR /F "delims=\, " %%k in (F:\iseries\workstations.txt) do shutdown \\%%k
/r /t:0 /c
Right now it creates the directory on all the machines and then moves onto
the next FOR loop. I would like instead to have one FOR loop but execute
all 5 commands then move onto the next machine in the file. Is this
possible? I normally do vbscript but I need to use a batch file for this
instead. Thanks for any help!
Mike
text file and executes a series of commands. Right now it uses 5 seperate
FOR loops to read the same file and execute the other commands. The first
one creates the directory on the machine, the 2nd copies the files to the
machines, 3rd runs the program, 4th deletes the files, and the 5th reboots
the machine. Here's the batch file:
FOR /F "delims=\, " %%j in (F:\iseries\workstations.txt) do md
\\%%j\c$\temp\iseries
FOR /F "delims=\, " %%i in (F:\iseries\workstations.txt) do copy
\\server\iseries\*.* \\%%i\c$\temp\iseries
FOR /F "delims=\, " %%g in (F:\iseries\workstations.txt) do psexec \\%%g
c:\temp\iseries\setup.exe
FOR /F "delims=\, " %%h in (F:\iseries\workstations.txt) do del
\\%%h\c$\temp\iseries /q
FOR /F "delims=\, " %%k in (F:\iseries\workstations.txt) do shutdown \\%%k
/r /t:0 /c
Right now it creates the directory on all the machines and then moves onto
the next FOR loop. I would like instead to have one FOR loop but execute
all 5 commands then move onto the next machine in the file. Is this
possible? I normally do vbscript but I need to use a batch file for this
instead. Thanks for any help!
Mike