-
Book Overview & Buying
-
Table Of Contents
WiX 3.6: A Developer's Guide to Windows Installer XML
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"
On Windows 8, this requirement of having a space after the equals sign has been removed.
After running this command, you'll see the new service in the services management console (services.msc) among the other installed services. Yours will show up as testsvc. It won't be started yet for you. You'll have to start it manually, either through the services management...