I'm using a tool that tests hard disks, fstest.exe. It runs fine from the command line, displaying how long it took to do various file-creation/-deletion/-mangling tasks. The usual output, when run from the command line as fstest.exe otherParams
, looks like this:
---
CPU Usage: 0.0%
Disk reads/sec: 0
Disk writes/sec: 0
Disk bytes/read: 0
Disk bytes/write: 0
Test duration: 0 milliseconds, 1153 ticks (3507177 ticks/sec)
---
The trouble is that when I redirect the output to file, it doesn't display anything:
fstest.exe otherParams > out.txt
creates an empty out.txt file, even though the command otherwise executed just fine (and created a few test-files as part of its execution).
How can I force this application to redirect output to a file? I've tried looking at it more closely with PowerShell (via Start-Process), and both the standard-out and standard-error streams are just empty.
Other things I've tried:
cmd /c "fstest.exe otherParams > out.txt"
fstest.exe otherParams 2>&1 >> out.txt
fstest.exe otherParams | sort
powershell Start-Process -FilePath .\fstest.exe -ArgumentList @("create2", "-openexisting") -RedirectStandardOutput out.txt -RedirectStandardError err.txt -wait
(That creates both out.txt and err.txt, both empty.)
What would cause an application to change its output depending on whether it's redirected, and is there any way I can make it redirect to file?
UPDATE: I've gotten my hands on the source code. It's C++, and the output is just straightforward printf
statements.