Create/delete/start/stop a service from command-line

For some reason, I just needed to do something like this, so here is a quick how-to:

There is a tool named sc.exe in the Win 2K Resource Kit, however I believe it also exists in Windows XP, as I did not have to do anything, and was able to access it from command-line.

Using this tool, you can see the list of the services that are currently running, add, delete, create or stop services.

The syntax for creating a service is like this:

sc create [service name] [binPath= ]

What this command does is basically the same as the CreateService API function.

Similarly, the commands to achieve other purposes are:

sc delete

sc start

sc stop

For more information you can have a look at here.

You can also view services existing on the system or even delete them from this registry key :

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Oh, and by the way, if; for some reason you need to get ahold of Windows 2000 Resource Kit Tools, you can get them here.

Advertisements

1 Comment

  1. September 23, 2010 at 9:35 pm

    Yes that right using SC command we can manage our services in command line. Command line is very easy when we have some problem with GUI. Great sharing blog. Thanks for same.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: