IP checking batch

August 29, 2010 at 21:22:21
Specs: Multiple OS, -
Here is what I have to check a list of IP addresses. the batch pings them and if there is no responce will place them into a txt file called offline. the online IP's are placed into an online.txt file. How do i get into the infomation (just before each IP address) like the subnet ip, the host ip and anything else like that??

this is for checking to see if all computers in the network have all the same information.

below is the code:

@echo off
SETLOCAL EnableDelayedExpansion

del online.txt
del offline.txt
del infoonline.txt
for /f "tokens=1" %%i in (list.txt) do call :process %%i
goto :exit
set system=%1
echo Processing %system%
ping -n 1 %system% /a |findstr -i "Destination"
if "%errorlevel%"=="0" (goto :error) else (goto :report)
goto :EOF
echo %system% >> Offline.txt
goto :EOF
echo %system% >> Online.txt
goto :EOF
if exist offline.txt echo Offline IP's:
if exist offline.txt type offline.txt
if exist online.txt echo Online IP's
if exist online.txt type online.txt

See More: IP checking batch

Report •

August 29, 2010 at 21:40:03
My ping results does not have "Destination", so i am not sure why you want to grab for "Destination". Show a few samples of your ping results that contain "Destination", and then show your desired output of things you want to get.

GNU win32 packages | Gawk

Report •

August 29, 2010 at 21:46:56
No it works... it orginal code had "reply" instead but all of my outputs had Reply but not all had "Destination" so yeah..

Change it how you like.

Report •

Related Solutions

Ask Question