Maybe this will help you:
http://msdn2.microsoft.com/en-us/library/system.diagnostics.processstartinfo.redirectstandardoutput.aspx
Also notice that Monad is now called Windows PowerShell. http://en.wikipedia.org/wiki/Windows_PowerShell
-- greetings dreeschkind
"Joey" wrote:
[Quoted Text] > How do I redirect the output from the call of a native command to my own > PSHost application? I'm able to recieve the output from cmdlets but when > calling a native command like tf.exe a new window is spawned and the output > is not redirected. The > > NotifyBeginApplication() method is being called in my host application, but > there are no parameters for me to hook onto the newly spawned process and > redirect it. > > Here is an example: > > $TFExecutablePath = "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" > > function DeleteWorkspace([String]$Name, [String]$TeamFoundationServerUrl) > { > $ErrorActionPreference = "stop" > # delete the workspace > & $TFExecutablePath\.\tf.exe workspace /delete $Name > /s:$TeamFoundationServerUrl /noprompt > # spit out the exit code > write-Host "ExitCode: $lastexitcode" > } > > DeleteWorkspace "Test" "MyServer" > > Since I'm running an external executable in this function I want to see the > output from the call to it and the following statement is what I'm expecting > to be redirected to my host application. > > TF14061: The workspace Test;domain\user does not exist. > >
|