Skip navigation

Q. How do I quote command parameters for an external command in PowerShell?

A. Normally, PowerShell can run external commands if you simply type the command name:


However, some commands require extensive command-line parameters. When those parameters start to involve quotation marks, it can get tricky to get PowerShell to properly parse the arguments and pass them to the external command. For example, consider this simple command:

Wdsutil /replace-image /image:"MyImage"

The easiest way to run it to use PowerShell’s Start-Process cmdlet, which can accept the complete argument as a here-string:

Start-Process WdsUtil -argument @"
/replace-image /image:"MyImage"

Note that you have to type it just like this: The @" must be the last thing on the first line, then you type whatever arguments you want passed, and finally the closing "@ must be the first two characters on the next line.

There’s a more technical discussion of this trick at, which also discusses how PowerShell parses arguments for external commands.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.