In my PS script I’m starting a process. This process reads from stdin (in my case it’s a file) and also outputs data. How can I display the output in window AND at the same time write this output to a log file?
This is what I have now and obviously it only displays output in a window:
Start-Process -Wait -FilePath “process.exe” -RedirectStandardInput $inputFile -RedirectStandardError “RESULTSerr.txt”
When I add:
-RedirectStandardOutput “RESULTSlog.txt”
then the log is written to the file but the window doesn’t display the log.
It seems like I need to use Tee-Object but I am not familiar with it so I need advice how to write the PS command.
submitted by /u/baal80
[link] [comments]
The post Redirect process output to screen AND file appeared first on How to Code .NET.