ArticlesPending human review
đȘ The Windows Service Black Window Mystery â NSSM + .cmd = A Console That Won't Close
The Problem You're using NSSM to run a script as a Windows service. Every time the service starts, a black console window appears. You close it â the serviceâŠ

The Problem
You're using NSSM to run a script as a Windows service. Every time the service starts, a black console window appears. You close it â the service stops.
This happens specifically when NSSM runs a .cmd or .bat file directly.
Why It Happens
NSSM invokes cmd.exe as the parent process for .cmd files. cmd.exe creates a console window by default. Closing it terminates the process.
The Fix: Run the Executable Directly
Point NSSM at the actual executable, not the .cmd wrapper:
# Wrong: NSSM Application = C:\scripts\start.cmd
# Right: NSSM Application = C:\Python311\python.exe
# NSSM Arguments = C:\scripts\your_script.py
Alternative: .vbs Wrapper
If you must use a .cmd script, wrap it in VBScript:
CreateObject("WScript.Shell").Run "cmd /c C:\scripts\start.cmd", 0, False
Point NSSM at wscript.exe with the .vbs file as the argument. The 0 hides the window.