SilthDraeth
Platinum Member
I am trying to create a simple batch file that I will run as a service on a domain controller that will force shutdown an entire computer lab.
What I have is:
FOR /F "tokens=1" %%a in (%COMPUTERNAME%.txt) do shutdown -t 30 -S -f -m %%a
I then have a txt file with the names of each computer.
I test it with just my local workstation in the txt and it works perfectly. The problem I run into is: If a computer name exists in the txt file, but that computer is not powered on, or the name doesn't resolve through DNS, the script will just hang on that computer name and never finish.
How do I get it to exectute each line in the txt file, and keep running if it comes across a computer name it doesn't like?
What I have is:
FOR /F "tokens=1" %%a in (%COMPUTERNAME%.txt) do shutdown -t 30 -S -f -m %%a
I then have a txt file with the names of each computer.
I test it with just my local workstation in the txt and it works perfectly. The problem I run into is: If a computer name exists in the txt file, but that computer is not powered on, or the name doesn't resolve through DNS, the script will just hang on that computer name and never finish.
How do I get it to exectute each line in the txt file, and keep running if it comes across a computer name it doesn't like?