Skip to main content
2 of 3
added 36 characters in body
Meir Tolpin
  • 365
  • 3
  • 14

Hot to escape space in powershell one liner

I want to run an exe with params using powershell one line, like this -

powershell -ExecutionPolicy Unrestricted "Start-Process -Path program.exe -ArgumentList somefile.txt, Run" 

And it works, but when I am trying to insert full path with spaces it's crashing

powershell -ExecutionPolicy Unrestricted "Start-Process -Path program.exe -ArgumentList "C:\Program Files\somefile.txt", "Run" " 

I tried to use single quote or escape with ` but it's not helping

Maybe someone know what I do wrong?

P.s. running from inside cmd.exe

Meir Tolpin
  • 365
  • 3
  • 14