I want to run a pretty basic script that has a list of executables (different python versions in this case) that runs them one by one in a loop as part of a command.
Example:
$py39 = python # can be full path to an .exe if needed
$py310 = python3.10
$py311 = python3.11
$pythons = $py39,$py310,$py311
Foreach ($py in $pythons)
{
$py --version
$py -c "print('hello world')"
}
"python", "python3.10", "python3.11" all launch their respective python version when I run it myself correctly.
When I run the script I get these errors. How do I make it work?
+ $py --version
+ ~~~~~~~
Unexpected token 'version' in expression or statement.
+ $py -c "print('hello world')"
+ ~~
Unexpected token '-c' in expression or statement.