## Saturday, December 8, 2012

### Running CMD in PowerShell with spaces in the parameters

If like me, you have spent hours trying to spawn a command shell from a PowerShell script when the arguments for the CMD command include a path with spaces, look no further.

start-process c:\windows\system32\cmd.exe '/c "C:\Program Files\software\do.bat"'

Note the following:
• There is a space in 'Program Files'
• The technique here is to wrap all the arguments between single quotes, and within that construct you wrap the path between double quotes.
That's it. Cheers!