Here is the code
$tool = "E:\Experiments\Popup\latest\xperf.exe" $toolOutput = "XPerfOutput.log" $toolError = "XPerfError.log" $command = "-stop" $x = Start-Process -FilePath $tool -ArgumentList $command -RedirectStandardOutput $toolOutput -RedirectStandardError $toolError -WindowStyle Hidden -PassThru -Wait
And there is an error:
Start-Process : Parameter set cannot be resolved using the specified named parameters. At E:\Experiments\Popup\asd.ps1:9 char:1 + Start-Process -FilePath $tool -ArgumentList $command -RedirectStandardOutput $toolOutput RedirectStandardError $toolError -WindowStyle Hidden -PassThru -Wait + ~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartProcessCommand
I want to start the process in a hidden window, wait for it to return and get the error, output and exit code.
RD
source share