Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi M2,
@echo off for /f "tokens=*" %%I in (IPlist) do call :pinger %%I goto :eof :pinger echo %TIME% >> pingLOG ping %1 >> pingLOG :: DONEI am using the above batch file command to ping list of 60servers and works perfectly. But I need to generate two output files. one output file for Pingable server list and other output file for non-pingable server list. Can u please help

:: ping list and log dead / alive
@echo off
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (IPlist) do (
ping %%a | find /i "reply" > nul
echo %time% >> !errorlevel!.log
echo %%a >> !errorlevel!.log
)
=====================================
If at first you don't succeed, you're about average.M2

Hi M2,
Thanks for your reply. This command works perfectly for me. But I can see out put file names as '0' and '1'.can you please help me how to give the output file name as 'Pingable'and 'Non-pingable'.
Thanks for you help
Mini

@echo off > 0.log & @echo off > 1.log
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (IPlist) do (
ping %%a | find /i "reply" > nul
echo %time% >> !errorlevel!.log
echo %%a >> !errorlevel!.log
)type 0.log >> Pingable
type 1.log >> Non-pingable
=====================================
If at first you don't succeed, you're about average.M2

Hi M2,
I have replaced 0.log with pingable.log and 1.log with Non-pingable.log but after that when I run the file I can see 4 logs created.Pingable and non-pingable logs are empty and 0 and 1 logs are showing the results..
Please help me to get only 2 logs pingable and non-pingable and correct results in that output logs..
@echo off > pingable.log & @echo off > Nonpingable.log
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (C:\test.txt) do (
ping %%a | find /i "reply" > nul
echo %time% >> !errorlevel!.log
echo %%a >> !errorlevel!.log
)

If it bothers you to have 0.log & 1.log left just end the bat with:
del ?.log
=====================================
If at first you don't succeed, you're about average.M2

My query is to get only 2 output logs with Names "Pingable"and "Non-Pingable" and appropriate results in the same logs.

@echo off > 0.log & @echo off > 1.log
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (IPlist) do (
ping %%a | find /i "reply" > nul
echo %time% >> !errorlevel!.log
echo %%a >> !errorlevel!.log
)type 0.log >> Pingable
type 1.log >> Non-pingabledel ?.log
=====================================
If at first you don't succeed, you're about average.M2

Hi M2,
One more small query..
I need bacth file command for check the list of URL's.
Like I have some list of URL's to check daily if they are up or not..So Can I check it using Batch file??Please help me..

Do you mean to ping them?
=====================================
If at first you don't succeed, you're about average.M2

You can ping a domain like:
www.kitco.com
but you can't ping a URL like:
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |