-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Open
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.
Description
Summary of the new feature / enhancement
Hello.
I am trying to start a process in a new window with Start-Process
and i'm -wait
ing for its execution.
Then i need to process its output. I would like to do it all in memory, without writing to disk, as the output is confidential. Unfortunately at the moment this doesn't seem to be possible (correct me if i'm wrong) without resorting to .NET implementations like this...
Currently, this is the best you can do:
$output = & {start-process powershell "read-host 'Enter string: '" -Wait -RedirectStandardOutput output.txt ; get-content output.txt}
In this example,
powershell "read-host 'Enter string: '"
is my command with confidential output.-Wait
waits for my command to exit-RedirectStandardOutput
permits the redirection to a fileget-content
simply reads back that file.
Proposed technical implementation details (optional)
A possible solution would be a parameter like -RedirectStandardOutputToStream
/ -RedirectStandardErrorToStream
$output = & {start-process powershell "read-host 'Enter string: '" -wait -RedirectStandardOutputToStream 1}
Where 1
is the ID of the success stream.
Or, more simply:
$output = & {start-process powershell "read-host 'Enter string: '" -wait -GetStandardOutput}
... with the corresponding -GetStandardError
SnosMe, tverilytt, SCP002 and heatzync
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.