Solved

Disable/Enable Service from command line

Posted on 2004-04-09
14
19,269 Views
Last Modified: 2011-03-03
Hello,

What is the command line to disable or enable a service from the command line? I have a DOS batch file that copies files. I would like to have the first line in the batch file disable the Norton antiviris service so it doesn't touch the files. Then, once the copy is complete I want to turn on the anti-virus service. I know this is risky but there is a method to my madness.

Thanks in advance,

J:\
0
Comment
Question by:jhieb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +4
14 Comments
 
LVL 22

Accepted Solution

by:
Christopher McKay earned 100 total points
ID: 10792378
Hi jhieb,
You can use "Net Start <servicename>"
and "Net stop <servicename>"

Hope this helps!

:o)

Bartender_1
0
 
LVL 1

Author Comment

by:jhieb
ID: 10792387
That's it. Hey, what is a quick way to find out the service name? The one in Services displays in the registry somewhere doesn't it? The registry name is probably the one I want to use.
0
 
LVL 49

Expert Comment

by:sunray_2003
ID: 10792394
check out options of net start and net stop here

http://www.computerhope.com/nethlp.htm

please give the pts to bartender as I am just adding up info
0
Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

 
LVL 22

Expert Comment

by:Christopher McKay
ID: 10792478
Actually, you can use the service names listed in the Services panel. Just make sure the names are in Quotes (in case the service name has spaces)

:o)

Bartender_1
0
 
LVL 1

Author Comment

by:jhieb
ID: 10792497
Yes, that's what I did. I just copied and pasted the name exactly like the name in the services panel, quoted it, and it worked fine. That was much easier, too. I searched for "services" in the registry and received about a zillion hits (maybe more).
0
 
LVL 22

Expert Comment

by:Christopher McKay
ID: 10792516
Thanks for the link sunray_2003. I appreciate the help.

:o)

Bartender_1
0
 
LVL 1

Author Comment

by:jhieb
ID: 10792527
Yes, thanks Sunray_2003. I added the link to my favorites.
0
 
LVL 22

Expert Comment

by:Christopher McKay
ID: 10792531
Thanks for the points jheib, I'm glad I was able to assist.

Cheers!

:o)

Bartender_1
0
 
LVL 49

Expert Comment

by:sunray_2003
ID: 10792916
thanks guys
0
 

Expert Comment

by:Riad
ID: 11068924

With net stop you can just stop service but after you reboot service will be running again.

Here is another way of managing services:

sc config Alerter start= disabled

This will set "Alerter" services startup parameter to disabled and it won't start anymore.

You can also use following flags:  <boot|system|auto|demand|disabled|error>


Best Regards,
Riad
0
 

Expert Comment

by:salmonsm
ID: 11162634
Riad,

Where is this sc command located?

Thanks

Michael S.
0
 

Expert Comment

by:salmonsm
ID: 11165462
never mind, i see it's in the NT resource kit. Thanks.
0
 
LVL 1

Expert Comment

by:septje
ID: 12460306
as a footnote to the discussion about the command line program SC, make sure you include a space between 'start=' and 'auto' or what ever mode you choose. For some reason it is quite pedantic about that..
0
 

Expert Comment

by:LAVORNL
ID: 26900108
Riad and septje - Thanks for the comments.  The accepted answer to this question is not the answer to the actual question.

Net Stop & Net Start are only used to stop and start services.  The SC command is what has to be used to enable/manual/disable a service.

BTW - Manual is equal to "demand".

If you type manual after "start=" then it won't work.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Task scheduler to manage event fails 4 870
Windows 2000 Print Server 2 1,059
windows 2000 image 3 148
Cannot Upgrade Microsoft Installer on Windows 2000 29 70
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Read  the original post  on Monitis Blog. Hi.  My name is Erik Dietrich, and this is the first time I’ve posted on the Monitis blog.  By way of introduction, I thought it would make sense to talk about my initial experience with Monitis.   Befo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question