|M2, two problems with this call:|
ping -n 1 192.168.1.226 | find "Reply" > nul
1. It does not work if you have Windows in another language ?!
2. If MS decides to change the output text ("Reply from ") it'll fail as well
The chance any of the above from happening, is larger than the chance they will decide to change the errorlevel return codes ... so :
ping -n 1 %machine% > nul
if errorlevel 1 goto :failure
echo Connection to %machine% is OK!
echo Connection to %machine% failed...