Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Explain the Batch script to ping multiple computers

$
0
0

Hello,
Please comment and explain each liner of the script.

@echo off
if exist d:\tools\computers.txt goto Label1
echo.
echo Cannot find d:\tools\computers.txt
echo.
Pause
goto :eof

:Label1
echo PingTest executed on %date% at %time% > d:\tools\z.txt
echo ================================================= >> d:\tools\z.txt
for /f %%i in (d:\tools\computers.txt do call :Sub %%i
notepad d:\tools\z.txt
goto :eof

:Sub
echo Testing %1
set state=alive
ping -n 1 %1 | find /i "bytes=" || set state=dead
echo %1 is %state% >> d:\tools\z.txt


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>