0
Below is the batch file command I am currently using to shutdown the remote computers through LAN Network.
Here is what it does.
- I have specified the remote computers IP address in text file named list.txt
- I have added an IP as 0.0.0.0 at the bottom of all the remote computer IPs.
- The below batch file will check if the computers are available over LAN.
- If the computer is available it will shutdown the remote PC else it will pass on to next IP.
- When the batch file reads 0.0.0.0 at last it will self shutdown the master computer.
My problem is I cannot run this batch for more than 7 remote computers. If I add more than 7 remote PC IP in list.txt the batch file hangs and action does not complete. Please let me know if i made any mistake in the code or How i can fix this issue.
I want to run this batch file for minimum of 12 remote PCs
@echo off
setlocal enableextensions enabledelayedexpansion
for /f %%a in (C:\Users\calcopm\Desktop\list.txt) do (
SET IP =%%a
SET C=0
IF %%a equ 0.0.0.0 (
shutdown /s
) ELSE (
ping -n 1 %%a | find "TTL=" >NUL: && SET C=1
IF !C! equ 1 (
psshutdown \\%%a
) else (
ECHO REMOTE %%a IS NOT REACHABLE
)
)
)
Hi Friend,I get your point I am going to use the "timeout" command above the ping to create a time delay of pinging between two PCs. Only thing I need to know is the minimum time delay required between pinging of two PCs. Is 1 second enough ? – Dragonborn – 2014-12-10T04:39:36.963
I would suggest you to apply some seconds and check it works or not. It may depends on machine reach. – vembutech – 2014-12-10T13:29:23.860
I have tried using the time delay of from 1 to 10 secs in whatever way I could but still same problem. – Dragonborn – 2015-01-17T06:38:42.127