I'm using the following command: for /f %a in ('ping -n 1 192.168.1.1^ | findstr /C:"Received = 0" ') do shutdown -s -f -t 5
then get the error message as "| was unexpected at this time."
Actually, i use a bat script for Windows server 2003: http://pastie.org/1202314 , but when i run it, i get a error as above.Anyone help me, plz!
for /f %a in ('ping -n 1 192.168.1.1 ^| findstr /C:"Received = 0" ') do shutdown -s -f -t 5Can I put a question here?
i tried to separat to 2 command line, then it done. :) ::make a file output.txt in C:\
ping -n 1 %host% > C:\output.txt
for /f %%a in ('findstr /C:"Received = 0" C:\output.txt ') do call :parse
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |