at work every now and then I want to ping computers to see if they are up or not. I work at a hospital, so the security is tight, and we don't get to download software. So I googled how to make a simple batch file to ping a range of IP's. so far I cobbled together this
SET /p subnet3=What is the 3rd octet?
SET /p subcount=What is the 4th octet?
SET /a subcount=%subcount%+1
ECHO Trying 10.170.%subnet3%.%subcount%
ping -n 1 -w 1000 10.170.%subnet3%.%subcount% >nul
IF %errorlevel%==0 ECHO 10.170.%subnet3%.%subcount% UP >> c:\install\pingup.log
IF %errorlevel%==1 ECHO 10.170.%subnet3%.%subcount% DOWN >> c:\install\pingdown.log
IF %subcount%==254 goto :eof
this works fine, and the ping log files work. However, at the command prompt the output looks like this.
but I want it to echo if the ip is up or down, so that it would look like this
Trying 10.170.4.6 UP
Trying 10.170.4.7 UP
Trying 10.170.4.8 DOWN
Trying 10.170.4.9 UP
Any Ideas what I am missing in this batch file?