Search code examples
windows-7cmdwhitespaceshortcutmmc

Cmd and mmc with whitespace paths


I'm trying to create a shortcut to an .msc file, but I want to open the file with another account. The closest I've come is:

runas /savecred /user:PATHy\USERx "mmc \\folder\subfolder\folder with space\file.msc"

and it works as long as there aren't any white spaces in the path name. I know that I should escape spaces with "" (quotations) in Windows but the runas command already require the mmc command to be escaped. Does anybody know how I can achieve this?

Thanks!


Solution

  • The runas documentation (runas /?) shows how to do this as one of it's examples:

    REM use backslash to escape your quotes, e.g., \"file with spaces\"
    runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""