[Solved] Powershell, space and nested quote (right click menu to open powershell here with admin privilege)
Posted: 15 Mar 2024 07:46
Hi guys I run into a problem with nested quotes, can someone please help me out?
I have got a script like this:
and it runs, except when there is a space in <curpath>...
But I don't know how to wrap it up with quotes, have tried some different approaches to no avail...
Thanks!
EDIT: I'm a stubborn guy who bangs my head over this for too long, a cautionary tale, but I did figure it out:
Yes you read it correctly, that is 7 double quotes in a row...
I have got a script like this:
Code: Select all
run "PowerShell -Command Start-Process PowerShell -verb runAs -ArgumentList '-NoExit', '-Command', 'cd <curpath>'",,,0But I don't know how to wrap it up with quotes, have tried some different approaches to no avail...
Thanks!
EDIT: I'm a stubborn guy who bangs my head over this for too long, a cautionary tale, but I did figure it out:
Code: Select all
run "PowerShell -Command Start-Process PowerShell -verb runAs -ArgumentList """"""-NoExit"""" """"-Command"""" """"cd '<curpath>'""""""",,,0