关于start-process命令


PowerShell交流中心分类: 进程和服务关于start-process命令
1
FAAAAT asked 5 年 ago

start-process -filepath “powershell” -verb runas -argumentlist “-file”,”C:\Users\v-yuli4\Desktop\au
to sync.ps1″ -redirectstandardoutput “c:\log\1.log”
运行提示错误
Start-Process : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ start-process -filepath “powershell” -verb runas -argumentlist “-file …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartProcessCommand
去掉redirectstandardoutput可以成功运行,但是脚本会报错。错误由于窗体一闪而过所以看不到。
不知道是什么原因感觉是个奇怪的问题 求各位大佬帮忙看一下。

1 Answers
0
Best Answer
Mooser Lee 管理员 answered 5 年 ago
start-process -filepath "powershell" -verb runas -argumentlist "-file C:\Users\v-yuli4\Desktop\auto sync.ps1" -redirectstandardoutput "c:\log\1.log"