Creating a Windows Service from an executable file

Windows Services are computer programs that run in the background according to the interface rules and protocols of the Service Control Manager, the component responsible for managing Windows Services.

This service you can start automatically when the computer boots, can be paused and restarted, and does not display any user interface.

You can easily create Windows Service by using exe file.

You can add or create a Windows Service in many ways. In this article, Bardimin will create Windows Service using Command Prompt (CMD) and Non-Sucking Service Manager (NSSM).

TOP TUTORIALS:  How to Enable HTTP/2 in Apache XAMPP

Before starting, prepare the exe or bat file that you will use as a service.

Creating a Windows Service using CMD

  1. Open CMD as administrator.
  2. Type the following code in the CMD window.
sc.exe create < service_name > displayname = < displayname > binpath = < path_file_executable >
  • service_name : a unique service name.
  • display_name : the name displayed on the interface.
  • path_file_executable : where the exe or bat file is located.

as an example

sc.exe create “ BardiminServ ” displayname = “Bardimin Service” binPath = "C:\BardiminApp.exe"
sc command

Creating a Windows Service using NSSM

  1. Download NSSM .
  2. Extract the downloaded zip file.
  3. Open CMD and change to the extracted file directory. Then type the following code to open the NSSM GUI
nssm install
nssm service
  1. Then fill in the location of your exe file and the name of the service.
  2. Then click the “Install Service” button
TOP TUTORIALS:  How to Uninstall Windows 10 Updates