Powershell – Invoke-Command : 无法使用指定的命名参数解析参数集

huangapple go评论75阅读模式
英文:

Powershell - Invoke-Command : Parameter set cannot be resolved using the specified named parameters

问题

[找不到任何相关或有效的答案,我检查了参数,它们是合法的]

我尝试用PowerShell运行一个可执行文件和相应的参数

这是代码:

Invoke-Command -FilePath "$execPath\xxxxxxxxxxxxxx.exe" -ArgumentList '--param1','param2'

这是错误信息:

Invoke-Command:无法使用指定的命名参数解析参数集。
在 xxxxxxxxx.ps1:18 字符:5
+     Invoke-Command -FilePath "$execPath\xxxxxxxxxxxxxx.exe" -Argument ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand

感谢您为我解答这个问题。

英文:

[Could not find any relevant nor working answer, I checked the parameters, they are legit]

I try to run an executable with its respective parameters, but with powershell

here is the line:

Invoke-Command -FilePath "$execPath\xxxxxxxxxxxxxx.exe" -ArgumentList '--param1','param2'

and here is the error

Invoke-Command : Parameter set cannot be resolved using the specified named parameters.
At xxxxxxxx.ps1:18 char:5
+     Invoke-Command -FilePath "$execPath\xxxxxxxxxxxxxx.exe" -Argument ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand

thanks for enlighting me on this one

答案1

得分: 1

我已经让它像这样工作了

& "$execPath\xxxxxxxxxxxxxx.exe" "param1" "param2"
英文:

I got it working like this

& "$execPath\xxxxxxxxxxxxxx.exe" "param1" "param2"

huangapple
  • 本文由 发表于 2023年6月15日 20:58:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76482729.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定