Batch file to remote shutdown network PC's

May 19, 2009 at 10:02:32
Specs: Windows XP

I'm looking to create a batch file that first
checks if a PC is connected (returns a reply in
ping) then if so send a remote shutdown to
that PC.

So far I have a batch file that parses IP
addresses from a text file and sends a remote
shutdown command to each IP in the file. Only
problem is if the PC is already off it takes an
eternity for the batch to complete (hours!!!!).

I would like for the batch to first ping the IP
address in the file then issue a remote
shutdown command if the ping response is

Any body done this before? It has been really
frazzled, dont have too much experience with
bat files and it has me in a bit of a loop :-( Ive
put in my working code so far below. Any help
or ideas appreciated

Code so far:

FOR /F %%i IN (computers.txt) DO shutdown
-m \\%%i -f -s -t 300 -c "Remote PC Shutdown
in progress"

See More: Batch file to remote shutdown network PCs

Report •

May 19, 2009 at 17:37:00
It is so necessary to use batch? You can use software such as available at that can shutdown multiple computers simultaneously with GUI skipping turned off ones. It also available in command line mode with the same functions.

Report •

May 20, 2009 at 01:42:25
It's a licensed software so if possible I'd rather try using a
batch file, even if it is only a few dollars

Report •

May 20, 2009 at 11:13:32
@echo off
FOR /F %%i IN (computers.txt) DO call:sd %%i

ping -n 1 %* >nul || ping -n 4 %* >nul
if not errorlevel 1 shutdown -m \\%* -f -s -t 300 -c "Remote PC Shutdown in progress"

rem untested code

Report •

Related Solutions

August 3, 2009 at 05:51:47
I'm using Network Shutdown Tool, but it's shareware...
I also tried to use a script. In our domain ~400 PCs in different subnet. I have stopped on this program... It has a free 30-day trial period, you can try.

Report •

Ask Question