yuval
yuval

Reputation: 3088

How to create a path with arguments to a service

I have tried the following:

sc create Test start=auto binpath= "C:\PATH\Example.exe Param1"

This work but when I try to start the service I get an error.
How do I add parameters to a service path?

Upvotes: 3

Views: 8051

Answers (1)

Harry Johnston
Harry Johnston

Reputation: 36318

If the path to the executable does not contain spaces, the command you're using should work. (The problem might be with the code in your service instead.)

If the path to the exectuable does contain spaces, you have to escape the quote marks like this:

sc create MyService binpath= "\"c:\Program Files\My Service\myservice.exe\" Param1"

Upvotes: 5

Related Questions