create dummy windows server with started status

lulala picture lulala · Jan 9, 2014 · Viewed 11.1k times · Source

I have created a dummy windows service using the following command:

sc create TestService binPath= C:\Temp\TestService.exe DisplayName= "TestService " start= auto

It successfully created a dummy service in services.msc but I would also need it to show a 'Started' status. I know this will require a bit of coding and my TestService.exe is blank.

Any idea how? I searched thru the net and it requires MS Visual Studio 2010 etc. Looks too complicated, all I need is a blank service that shows a 'Started' status that will be used for testing purpose.

Answer

Helvio picture Helvio · Sep 23, 2015
  1. Create a dummy.bat file in C:\ with contents "pause"
  2. Download NSSM from http://www.nssm.cc/download
  3. Extract nssm.exe (x86 or x64) to C:\Windows\nssm.exe
  4. Run "nssm install"
  5. Path: C:\dummy.bat
  6. Service name - As you wish!
  7. Hit "Install service"

After that, you'll have a service named after step 6, which you can start, stop, restart...

Hope it helps!