I would like to run commands in a batch file on multiple computers.
For example:
@echo off
ping %1
pause
exit
If this batch file were called pingme.bat, and I type pingme.bat yahoo.com, then it would ping yahoo.com. My problem is I want the batch file to accept input from a text file.
For example, pingme.bat computers.txt would read the names of computers listed in the computers.txt file, and do whatever command I specified to be done to them.
%1 accepts the input I specify when I type the batch file. Now I would like the batch file to read the lines from that input text file and use them as arguments to the command.
The lines in the text are in list form, not using commas or anything.
One way to do so would be to place the URLS in a text file like so:
http://www.google.com
http://www.yahoo.com
Then run the following batch
and run it from cmd as pingme.bat URLs.txt
Alternatively, you may specify the text file’s name within the batch, and run it without the parameter
Here’s another approach
This particular batch will pull from the list, and write to output.txt if the ping was successful
Hopefully that sets you in the right direction.