[Windows] The detailed steps of converting the ordinary console EXE program to run in windows service mode

background

NSSM (Non-Sucking Service Manager) is a free third-party Windows service manager that can convert any executable file into a Windows service. The official website download address is: https://nssm.cc/download
The following are the detailed steps and precautions for NSSM to configure Windows services:

step:

  1. Download and unzip the NSSM program file.
  2. Open a command prompt or PowerShell and change to the directory where the NSSM.exe file is located.
  3. Run the following command: nssm install "service name". where "service name" is the name of the Windows service you want to create.
  4. In the pop-up GUI, select the executable file path you want to configure.
  5. In the "Startup directory" field specify the startup directory for the executable, if desired.
  6. Enter the command-line arguments, if any, passed to the executable in the "Arguments" field.
  7. Click the "Install service" button.

Precautions:

  1. NSSM requires administrator privileges to run.
  2. NSSM should only be used to turn trusted binaries into services. Before turning a file into a service, it must be ensured that it has been tested and has no security holes.
  3. If NSSM is improperly configured, it may cause system failure or instability.
  4. After NSSM configures the service, you should check the Windows Service Manager to make sure the service is properly installed and running.

Guess you like

Origin blog.csdn.net/qq_38428623/article/details/130501333