Manually creating a service in Windows

by Per Hansen
 

Overview

A Windows service is an application that runs in the background similar to a Unix daemon. You can create your own service based off an executable via the command line.

Instructions

The syntax for the command to create a service is the following:

sc create service_name binpath=C:\path\to\binary [option1] [option2] [optionN]

The trick is to leave a space after the = in your create statement, and also to use " " for anything containing special characters or spaces.

It is advisable to specify a Display Name for the service as well as setting the start setting to auto so that it starts automatically. You can do this by specifyingDisplayName=yourdisplayname andstart=auto in your create statement.

Here is an example:

\sc create asperacentral binPath="C:\Program Files\Aspera\Enterprise Server\bin\asperacentral.exe" ^
DisplayName="Aspera Central" start=auto

If this worked you should see:

[SC] CreateService SUCCESS
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk