Author: rmetzger
Subject: psping.exe -q doesnt really make it quiet
Posted: 23 December 2014 at 2:23pm
All the SysInternal pstools console info can be redirected. (Batch Redirection is an OS operation.)
I do not believe the "Output.txt" file has the reported 5 lines of text.
That said, Try this:
Your command: PsPing -q -n 5 ap.no >output.txt
My command: PsPing -q -n 5 ap.no 1>output.txt 2>NUL
That should eliminate the copyright info from reaching the screen, as this info is output to the STDERR (handle 2). Output.txt should collect STDOUT (handle 1).
Your example implicitly uses STDOUT and does not specify what to do with STDERR output.
Here is a good review of Batch Redirection:
http://www.robvanderwoude.com/redirection.php
Let us know if this helps.
Ron Metzger
Subject: psping.exe -q doesnt really make it quiet
Posted: 23 December 2014 at 2:23pm
![]() I'm trying to use psping.exe -q in a bat, and I want to send the results to a text file for later processing. But whenever psping.exe is executed it spews out 5 lines of noise: version info, copyrights, links etc. I cannot have this noise in the script it's being executed from, because it's being directly parsed by another program. This program will fail when it receives all the noise from psping.exe Its apparently impossible to redirect it to a file or NUL. It wil ALLWAYS end up in the console. And the progress counter as well.... sigh. C:\psping -q -n 5 ap.no >output.txt I reported an identical issue with psexec a few years ago (without any response from the developer). |
All the SysInternal pstools console info can be redirected. (Batch Redirection is an OS operation.)
I do not believe the "Output.txt" file has the reported 5 lines of text.
That said, Try this:
Your command: PsPing -q -n 5 ap.no >output.txt
My command: PsPing -q -n 5 ap.no 1>output.txt 2>NUL
That should eliminate the copyright info from reaching the screen, as this info is output to the STDERR (handle 2). Output.txt should collect STDOUT (handle 1).
Your example implicitly uses STDOUT and does not specify what to do with STDERR output.
Here is a good review of Batch Redirection:
http://www.robvanderwoude.com/redirection.php
Let us know if this helps.
Ron Metzger