I want to redirect the output from an automated and unattended run of TreeSize to a file, so I can review it later if needed. Is that possible?
Starting TreeSize from a command line (cmd.exe), you can use the pipe-notation to redirect output from the standard output stream (1) and standard error stream (2) to a file. E.g.:
TreeSize.exe /NOGUI C:\ 1>StdOut.txt 2>StdErr.txt
From the PowerShell, it's recommended to use the Start-Process command with matching parameters:
Start-Process -FilePath .\TreeSize.exe -ArgumentList "/NOGUI C:\" -RedirectStandardOutput ".\StdOut.txt" -RedirectStandardError ".\StdErr.txt"