Saved Bookmarks
| 1. |
Solve : ping replay? |
|
Answer» How do I get my computer to only log the ip’s that reply’s in a ping. I’m having the batch ping series of a computers and if it replays I want it to out put it to a file, would this be a for COMMAND with | find/i "reply" do echo>> text.txt How do I get my computer to only log the ip’s that reply’s in a ping. I’m having the batch ping series of a computers and if it replays I want it to out put it to a file, would this be a for command with | find/i "reply" do echo>> text.txt i assume you have a list of ips to ping. So you would do a for loop over these ips, then use the ping command. eg for ip in list_of_ips: ping -n 1 ips > NUL if errorlevel is 0 then echo "ip is alive" just a SUGGESTION... so how would i do this i have a veriable set for the ip the VAR is ip1 so how would i make this workQuote so how would i do this i have a veriable set for the ip the var is ip1 so how would i make this work have not done batch for a while.guess might be something like this @echo off FOR /F %%i in (file_with_ip_list.txt) do ( ping -n 1 %%i > nul if %errorlevel% == 0 (echo %%i is alive >> output_file.log ) ) think you that worked or to be simplier. @echo off ping (where every you want)>>log.txt |
|