Q:

powershell start-process command with spaces

Can anyone tell me why this doesn't work in Windows 10?
{start-process powershell 'start-process c:\windows\syswow64\mmc.exe """c:\path\to\my\administrative tool\console1.msc""" -verb runas' -credential domain\user}

It was working just fine and dandy under Windows 8.1. However, after moving to Windows 10 this morning, the code errors out at the space in the path to console1.msc.
Thanks in advance!

A:

It appears that each step along the way of launching a PowerShell process from a PowerShell process to launch MMC eats up some double-quotes to guard against spaces. (Arguments to PowerShell itself can require escaping as well.) Therefore, you need to escape those quotes further. In fact, you need nine - count them, nine - double-quote characters on each side:
start-process powershell 'start-process c:\windows\syswow64\mmc.exe """""""""c:\administrative tool\console1.msc""""""""" -verb runas' -credential domain\user

