$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')"
}
$py39 = "python" # Full path to the executable if needed
$py310 = "python3.10"
$py311 = "python3.11"
$pythons = $py39, $py310, $py311
foreach ($py in $pythons) {
& $py --version # Use the & operator to run the command
& $py -c "print('hello world')" # Same here for -c
}