Calling Powershell from VBScript with parameters
Posted on 2011-09-21
I am calling Powershell script from VBScript and passing it two parameters. The problem is that my Powershell script path has spaces in it and so does my second parameter
Here is my code:
sCmd="C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\My Path\test.ps1 " & _
"parameter1 " & _
"this is second"
objShell.Run sCmd, 1, true
The script only runs if I change the path to C:\MyPath\test.ps1 but the thing is that it needs to be C:\My Path\test.ps1
Also when I retrieve arguments with powershell:
this is second
Can anyone help?