Ping to File

Batch

Public Domain

pings all computers listed in c:computers.txt and writes results to a notepad file

Download (right click, save as, rename as appropriate)

Embed

Tags:

batch cmd ping
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@echo off

(Set InputFile=c:\Computers.txt)

title,Pinging list of computers &color 9e

::datestamp
for /f "tokens=2-4 skip=1 delims=(-./)" %%i in ('echo.^|date') do (
   for /f "tokens=1-4 delims=-./ " %%m in ('date /t') do (
      (set dow=%%m)&(set %%i=%%n)&(set %%j=%%o)&(set yy=%%p) ) )
For /F "tokens=1,2 delims=:, " %%i in ('TIME /T') Do (Set HHMM=%%i%%j)

(Set OutputFile=c:\Pinglog %yy%-%mm%-%dd% %HHMM%.txt)

If Exist "%OutputFile%" Del "%OutputFile%"

For /F "eol=;" %%* in ('type "%InputFile%"') do (
 >>"%OutputFile%" (echo.&echo.---------------&(
 echo.%%*;&(ping -a -n 2 -w 750 %%* | Find "."))
 )&echo.done %%*,)


::check
start notepad.exe %OutputFile%