NSSM - the Non-Sucking Service Manager
Introduction
NSSM (Non-Sucking Service Manager) is a tool that allows you to install and manage Windows services easily. It is particularly useful for running non-service applications as Windows services.
Steps to Create a Custom Windows Service Using NSSM
1. Download NSSM
Download NSSM from the official website or a trusted source: https://nssm.cc/download
Extract the ZIP file to a directory, e.g.,
C:\nssm.
2. Open Command Prompt as Administrator
Press
Win + R, typecmd, and pressCtrl + Shift + Enterto open an elevated command prompt.
3. Install the Custom Service
Use the following command to install your application as a Windows service:
C:\nssm\nssm.exe install MyServiceThis will open the NSSM GUI.
4. Configure the Service in the NSSM GUI
In the
Applicationtab:Set Path to the full path of the executable (e.g.,
C:\myapp\myapp.exe).Optionally, set Startup directory if required.
If your app requires arguments, enter them in the Arguments field.
In the
Detailstab:Set Display Name and Description for the service.
In the
Log ontab:Specify the user account under which the service should run (default:
LocalSystem).
In the
Startuptab:Set Startup Type to
Automaticif you want the service to start on boot.
Click Install service to complete the setup.
5. Start the Service
Start the service using:
net start MyServiceOr via the Services (
services.msc) management console.
6. Managing the Service
Stop the service:
net stop MyServiceRemove the service:
C:\nssm\nssm.exe remove MyService confirm
This method ensures that your application runs as a Windows service and restarts automatically if it crashes.
Last updated
Was this helpful?