When I use the following command on the powershell console, it works correctly and I see admin command prompt open and the script sudo.bat executes correctly.
sudo.bat contains one line, cd c:\temp\
Start-Process cmd \"/k C:\Users\Varun\Documents\sudo.bat cd /d %cd%\" -Verb RunAs
But below one doesn't work, i.e. when the path has space, the admin command prompt opens but it doesn't run the script file.
Start-Process cmd \"/k C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat cd /d %cd%\" -Verb RunAs
I tried following and it did not work:
Start-Process cmd \"/k \"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat\" cd /d %cd%\" -Verb RunAs
and:
Start-Process cmd \"/k 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat' cd /d %cd%\" -Verb RunAs

