Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, November 10, 2011 1:04 AM
Start-Process has a RedirectStandardOutput parameter. What can I supply to that parameter to have it throw away the output instead of redirecting it to a file?
All replies (8)
Thursday, November 10, 2011 11:58 AM ✅Answered
The strategy here is to wrap some PowerShell around the launch of a particular application, and suppress the user seeing any messages (error or otherwise) that are produced by the launching of the program. I don't want the user to be confused by unexpected and cryptic messages.
Using a -WindowStyle Hidden option with start-process should take care of that.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Thursday, November 10, 2011 1:14 AM
You can use a cmdlet to do similar:
Start-Process (whatever) | Out-Null
Rich Prescott | Infrastructure Architect, Windows Engineer and PowerShell blogger | MCITP, MCTS, MCP
Engineering Efficiency
@Rich_Prescott
Client System Administration tool
AD User Creation tool
Thursday, November 10, 2011 1:18 AM | 1 vote
start-process -redirectstandartoutout nul
would work
But why do you even want to specify RedirectStandartOutput in the first place? You can just not have the parameter and the output will be thrown away anyway.
Thursday, November 10, 2011 1:19 AM
That makes a lot of sense. Is there an easy way to do that with Standard Error, or even Standard In?
Thursday, November 10, 2011 1:20 AM
sorry for my English, it's no so good :)
what kind of output you want to throw away? is this output from cmdlet or from process?
Вернигора Андрей, http://eosfor.blogspot.com
Используйте Problem Steps Recorder
MCP, MCDBA, MCSA, MCSE
Thursday, November 10, 2011 1:30 AM
You can use a cmdlet to do similar:
Start-Process (whatever) | Out-Null
This is not what the OP wants, I think. This is for output of start-process cmdlet itself and not the process that was started.
Thursday, November 10, 2011 1:31 AM
Redirecting to out-null seems to work. Output does NOT get thrown away by default, according to the help file for Start-Process. And strangely, trying to use -RedirectStandardOutput and -RedirectStandardError and point them both to out-null generates an error. It complains that both parameters are not allowed to have the same value. Very odd.
The strategy here is to wrap some PowerShell around the launch of a particular application, and suppress the user seeing any messages (error or otherwise) that are produced by the launching of the program. I don't want the user to be confused by unexpected and cryptic messages.
Friday, November 11, 2011 8:41 AM
Hi Mike,
Please feel free to let us know if the information was helpful to you.
Regards,
Tiger Li
TechNet Subscriber Support in forum
If you have any feedback on our support, please contact [email protected].
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.