Using sc.exe

To communicate with the Service Control Manager, you can use a command-line tool called sc.exe. Note that you ought to be logged in as an administrator before running this utility. To register our executable as a service, we'll use its create command. Every service gets a behind-the-scenes short name such as testsvc. Specify the new name as the first parameter to create. The binPath parameter sets the path to the executable. Be sure that the equal sign has no spaces before it and one after it. Follow this convention with all sc.exe parameters that use an equal sign.

sc create testsvc binPath= "C:\WindowsService1.exe"

Note

On Windows 8, this requirement of having a space after the equals sign has been removed.

After running this command, ...

Get WiX 3.6: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.