Geeks help me
Posted: Wed Mar 12, 2008 9:31 pm
Basically I have this file below. I want to check various pc's across a corporate network by pinging the pc name not the IP. I can put the pc name in the hosts.txt file and it works ok however, I want to also put a short description after the pc name that shows up in the results file. So basically I want to ping "PCname computer at station 10" and if I get no response I want that to show up in the results file not just the name.
Can anyone help?
@Echo Off
TITLE Visa Scale Connectvity Tester
DEL PINGresults.txt
SET MachineList=HOSTS.txt
SET ResultsFile=PINGresults.txt
CLS
ECHO.
IF NOT EXIST "%MachineList%" (
ECHO Cannot locate Machine List: %MachineList%
PAUSE>NUL
GOTO :EOF
)
FOR /f "tokens=*" %%M in (%MachineList%) do CALL :CHECK "%%M"
PINGresults.txt
GOTO :EOF
:CHECK
SET Machine=%~1
SET Machine=%Machine: =%
PING -n 1 %Machine%>NUL
Echo Processing %Machine%
IF %ERRORLEVEL% EQU 1 ECHO %Machine% did not respond at %Time%>>%ResultsFile%
EXIT /B
:EOF
Can anyone help?
@Echo Off
TITLE Visa Scale Connectvity Tester
DEL PINGresults.txt
SET MachineList=HOSTS.txt
SET ResultsFile=PINGresults.txt
CLS
ECHO.
IF NOT EXIST "%MachineList%" (
ECHO Cannot locate Machine List: %MachineList%
PAUSE>NUL
GOTO :EOF
)
FOR /f "tokens=*" %%M in (%MachineList%) do CALL :CHECK "%%M"
PINGresults.txt
GOTO :EOF
:CHECK
SET Machine=%~1
SET Machine=%Machine: =%
PING -n 1 %Machine%>NUL
Echo Processing %Machine%
IF %ERRORLEVEL% EQU 1 ECHO %Machine% did not respond at %Time%>>%ResultsFile%
EXIT /B
:EOF