Wednesday, February 15, 2012

Redirecting PowerShell script output to a file

I just wanted to redirect my PowerShell script output to a file, and at the same time see what's being written to the file.

This command does the trick:
 D:\Scripts\Sample.ps1 2>&1 |Tee-Object -File D:\Logs\myScriptLog.log

Reference:
http://stackoverflow.com/questions/3822650/how-can-i-output-handbrake-output-to-both-the-screen-and-to-a-file

*joychua97

No comments:

Post a Comment