首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Start-Process出现错误

Start-Process出现错误
EN

Stack Overflow用户
提问于 2010-12-28 03:57:00
回答 1查看 6.1K关注 0票数 9

下面是代码

代码语言:javascript
复制
$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  

这里有一个错误:

代码语言:javascript
复制
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

我想在一个隐藏的窗口中运行这个进程,等待它返回并得到错误、输出和退出代码。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-12-28 13:05:51

根据documentation for Start-Process,重定向参数(RedirectStandardOutput和RedirectStandardError)和WindowStyle参数的组合是无效的,因为它们存在于单独的parameter sets中。

这意味着它们不能一起使用。这就是为什么你会收到这个特殊的错误。

票数 12
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4541392

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档