From cmd I'm using the powershell command to elevate a batch script and pass it arguments. The arguments contain double quotes but I can't figure out why it's not working.
Here's my command:
powershell -command "Start-Process -FilePath 'C:\My Path\update.bat' -ArgumentList '\"My File.zip\"'"
The above command works fine and my batch script receives the argument in double quotes, but when I change the command to elevate using -Verb Runas
is where I have the problem (the batch script opens, but immediately closes):
powershell -command "Start-Process -Verb Runas -FilePath 'C:\My Path\update.bat' -ArgumentList '\"My File.zip\"'"