Ecco il codiceavvio del processo dà l'errore
$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
e qui c'è errore:
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
voglio eseguire il processo in una finestra nascosta, attendere che ritorni e ottenere l'errore , uscita e codice di uscita.
Qual è il valore di $ XPerfFolder? Stai combinando $ XPerfFolder in "C: \ Experiment \ ....". Non ha alcun senso a meno che $ XPerfFolder non sia vuota. –
che ora è riparato qui. Il codice è buono –
Il particolare EXE non funziona correttamente quando si tratta di errori. Ho notato che tende a far scoppiare l'interfaccia utente piuttosto che scrivere su stderr. –