|
Answer» Dear All,
I ping the hostname to get the OUTPUT for each result and ERROR log to save it success ping or failed in excel file format
ping 192.168.1.7.2 ping 192.168.1.7.3 ping 192.168.1.7.4
May I know how to write the SCRIPT ? Kindly to advice
Thank you very much
http://www.robvanderwoude.com/redirection.php.xls is not a file that batch can redirect into.Thank you for all
I have 100 PC to do ping test. May I know how to write the script to capture the result if error or success It depends on how you define error and success. The ping command can throw multiple different outputs, not just yes or no. To start, I would look at for /f to loop through a text file that contains all your ip addresses. After that you simply ping each in turn and have a big if tree to show success or failure, redirecting the output into a file.
Quote from: sun_os on November 01, 2014, 10:49:49 AM I have 100 PC to do ping test. May I know how to write the script to capture the result if error or success
This should work - with ONE PC address PER line in file.txt
Code: [Select]echo off ( for /f "usebackq delims=" %%a in ("file.txt") do ( ping -n 1 %%a |find "TTL=" >nul if errorlevel 1 (echo %%a failed) else (echo %%a passed) ) )>output.log
|