1

[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

0

1 Answer 1

1

I got it working like this

& "$execPath\xxxxxxxxxxxxxx.exe" "param1" "param2"
Sign up to request clarification or add additional context in comments.

1 Comment

Indeed, that's the best solution - use of Invoke-Command for local calls is rarely needed. -FilePath can (a) only be used in remote calls and (b) only with a script file path (*.ps1), not executables in general; such calls require use of a script block ({ ... }) instead. See the liked duplicate for details.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.