Lohiki
Lohiki

Reputation: 41

How to pass argument to Start-Process

I'd like to run this command net start "PTV LOXANE xDataServer 1.4.1.067" using Start-Process in powershell with admin rights. My problem is how to give the quote to ArgumentList. I've tried this but it doesn't work

Start-Process net -ArgumentList "stop \"PTV LOXANE xDataServer 1.4.1.067\"" -Verb runas -wait -NoNewWindow -PassThru

Upvotes: 1

Views: 944

Answers (1)

Lohiki
Lohiki

Reputation: 41

I've found how to do it. You must double the quotes: Start-Process net -ArgumentList "start ""PTV LOXANE xDataServer 1.4.1.067""" -wait -PassThru -Verb runas

Now I've got a second question. How can I run this command when calling powershell ? This doesn't work:

powershell -Command 'Start-Process net -ArgumentList "start ""PTV LOXANE xDataServer 1.4.1.067""" -wait -PassThru -Verb runas'

Upvotes: 1

Related Questions