DISQUS

DISQUS Hello!  The comments on this profile are unclaimed and thus are unverified.

Do they belong to you? Claim these comments.

jwalker's picture

Unregistered

Feeds

aliases

  • jwalker

jwalker

5 years ago

in Processing the contents of a text file using FOR loop | Batch file programming | Tech-Recipes on Tech-Recipes
If you need to run multiple commands against one of the computers in the list, you can structure in the following way (my comments formatted for batch files; change double percents (%%) to single (%) to run on command line:

FOR /f %%a in ('complist.txt') do call :MY_SUB %%a
GOTO SUB_DONE

:MY_SUB

REM Here, the computer name was passed as a parameter, so it comes in as %1

REM Example - copy a file to the computer
copy myfile.txt \%1c$

REM run this to end the subroutine

GOTO :EOF
:SUB_DONE

REM subroutine is finished, rest of the batch file continues
Returning? Login