I use a tool that checks hard drives, fstest.exe. It works great from the command line, showing how long it took to complete the various tasks of creating the / -deletion / -mangling file. The usual output when launched from the command line fstest.exe otherParamslooks 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 problem is that when I redirect the output to a file, it doesn't display anything:
fstest.exe otherParams > out.txt creates an empty out.txt file, even if the command otherwise runs just fine (and created several test files as part of its execution).
How to make an application redirect output to a file? I tried to study it more closely with PowerShell (via Start-Process), as well as standard and standard, error flows are simply 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
(This creates both out.txt and err.txt, both empty.)
What can cause an application to change its output depending on whether it is redirected, and is there a way to redirect it to a file?
UPDATE: I got the source code. This is C ++, and the output is just instructions printf.
source
share