Windows Service – How to Start with Specific Parameters

windowswindows-service

How do I start a service with certain parameters? In another question I have found

net start servicename blah

but if I try this, net throws a syntax error at me.

What am I doing wrong?

Edit: To clarify net start servicename works just fine, but I need to pass parameters to the service. I can do this manually in services.msc by filling in a start parameter before starting the service. But how can I do this from a script?

Another edit: Sorry, but my question was misleading. In my tests, I had many more parameters and it's not the /blah net start complains about. In fact, anything starting with a slash is fine. So net start servicename /blah works, net start servicename blah doesn't work. Since I need net start servicename /foo bar, it's the bar that is the problem.

Best Answer

sc start fooservice arg1 arg2 ...