0

The py -3 -m venv venv command works when typed manually into a Powershell terminal, but breaks when called from a ps1 script.

What specifically must be changed in the code below in order for the setup.ps1 script to successfully run the py -3 -m venv venv command when the setup.ps1 is called from outside using the Invoke-Command -FilePath setup.ps1 or a similar replacement command?

The contents of the setup.ps1 command are:

py -3 -m venv venv

The command that calls setup.ps1 including the error together look like:

PS C:\path\to\dir\containing_setup_py> Invoke-Command -FilePath setup.ps1
Invoke-Command : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Invoke-Command -FilePath setup.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Command], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand

PS C:\path\to\dir\containing_setup_py>
2
  • Why are you trying to use Invoke-Command? Just do .\setup.ps1 Commented Jan 21, 2023 at 11:42
  • 1
    It should work with just .\setup.ps1 if you specify shell: pwsh Commented Jan 24, 2023 at 6:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.