HelpMe01
asked on
problem with batch file running in windows 7 pro workstation
trying to echo %%1 to success.txt, if it fails, I want to send it to fail.txt (Nothing outputs to success.txt or fails.txt. What am i doing wrong ?
Windows 7 pro in a win2k8 domain
test.bat
cls
for /f %%i in (wks2.txt) do ping %%i -n 1 | find "Reply">nul
if not errorlevel 1 echo %%i>success.txt
Windows 7 pro in a win2k8 domain
test.bat
cls
for /f %%i in (wks2.txt) do ping %%i -n 1 | find "Reply">nul
if not errorlevel 1 echo %%i>success.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't see the "falling" part:
cls
del success.txt fail.txt 2>nul
for /f %%i in (wks2.txt) do ping %%i -n 1 | find "Reply">nul && echo %%1>>success.txt || echo %%i>>fail.txt
if not errorlevel 1 echo %%i>success.txt
If you can add a utility to the target computer, use ifping
http://www.anykeyonline.nl/oldsite/documents/44.html
http://www.anykeyonline.nl/oldsite/documents/44.html
ASKER
Solution by Lee W - the output has all workstations whether they work or not in success.txt (Doesn't work)
Solution by Hackoo - Is there anyway to separate the output into two files. worked.txt and failed.txt (worked, but I need a few changes)
Solution by Shaun Vermaak - Boss won't let me use third party apps
Solution by Hackoo - Is there anyway to separate the output into two files. worked.txt and failed.txt (worked, but I need a few changes)
Solution by Shaun Vermaak - Boss won't let me use third party apps
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this:
Open in new window