DOS batch programming question

Discussion in 'OT Technology' started by Joe_Cool, May 3, 2004.

  1. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,185
    Likes Received:
    508
    Today I need to remotely run a batch file against about 300 workstations. I have a text file with the names of all the workstations.

    How would you automate that? The command is of the form:
    batchfile.bat wks1234

    Now I could do this:
    for %%i in (wks0001 wks0002 wks0003 ...) do batchfile.bat %%i

    but then I'd still have to type in 300 names. How can I run it with each name in the file (1 name per line) automatically with a single command?
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    for /f %%i in (c:\listofworkstations.txt) do call batchfile.bat %%i
     
  3. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,185
    Likes Received:
    508
    sweet. Thanks.
     
  4. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    :coold: It's a dying art
     
  5. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,185
    Likes Received:
    508
    DOS is really underappreciated by most people. It pretty well kicks butt, when used properly.
     

Share This Page