Given:
# test1.ps1
param(
$x = \"\",
$y = \"\"
)
&echo $x $y
Used like so:
powershell test.ps1
Well, this is a cmd.exe
problem, but there are some ways to solve it.
Use single quotes
powershell test.ps1 -x 'hello world' -y 'my friend'
Use the -file
argument
powershell -file test.ps1 -x "hello world" -y "my friend"
Create a .bat
wrapper with the following content
@rem test.bat
@powershell -file test.ps1 %1 %2 %3 %4
And then call it:
test.bat -x "hello world" -y "my friend"