a variety on this question has been asked and answered https://stackoverflow.com/a/21709463/3906864
I followed the above linked answer and did the following
">log.txt"
that argument was added here
This allows the console output to be redirected from console to file, and the console window remains blank without anything displayed in it.
but i can't find a way to view the output in console while still simultaneously saving a copy to a txt file. any ideas ?
you need a version of tee
. Powershell has Tee-Object
( https://technet.microsoft.com/en-us/library/hh849937.aspx )
An example from link
get-process | tee-object -filepath C:\Test1\testfile2.txt
The above will output both to terminal and to the file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.