Tuesday, March 30, 2010

NET START and listing the service names

On Windows, I'd long known you could short-cut a trip to start->control panel->admin tools ->services, scroll through list of services, right click and restart by simply using cmd.exe and typing 'net start service-name'. What I didn't know was how you could enumerate the service names (a good example: different VNC servers might be called wvnc, vnc-server, and so on).

The answer: type 'net start' by itself to list them. Of course!

It's not exactly logical (I was thinking with net start and net stop, there might be a net list command but no, net start by itself lists them).

Oh, and if the service name has a space in it, you have to put quotes around the service name:


net stop "VNC Server"
net start "VNC Server"

2 comments:

  1. Just try and use the Net Stop command with a service that keeps changing it's own name - oh the fun of virus infections.
    What I'd like to find is a way to send Net Stop either continuously, or at small scheduled intervals. Before you ask, Windows Scheduler doesn't run processes fast enough...

    ReplyDelete
  2. Yeah, virii suck. I think the only real solution there is bring it up in safe mode without services started... or boot from an alternative media (Linux LiveCD) and nuke the virus's service(s).

    I suppose you could write a small app to do this, or a script that does the windows equivalent of while(true); do net stop; sleep 1; done

    ReplyDelete