简体   繁体   中英

create dummy windows server with started status

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.

  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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM