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).
Before starting, prepare the exe or bat file that you will use as a service.
Creating a Windows Service using CMD
- Open CMD as administrator.
- 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"
Creating a Windows Service using NSSM
- Download NSSM .
- Extract the downloaded zip file.
- Open CMD and change to the extracted file directory. Then type the following code to open the NSSM GUI
- Then fill in the location of your exe file and the name of the service.
- Then click the “Install Service” button