jhieb
asked on
Disable/Enable Service from command line
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:\
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:\
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
http://www.computerhope.com/nethlp.htm
please give the pts to bartender as I am just adding up info
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
:o)
Bartender_1
ASKER
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).
Thanks for the link sunray_2003. I appreciate the help.
:o)
Bartender_1
:o)
Bartender_1
ASKER
Yes, thanks Sunray_2003. I added the link to my favorites.
Thanks for the points jheib, I'm glad I was able to assist.
Cheers!
:o)
Bartender_1
Cheers!
:o)
Bartender_1
thanks guys
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|d
Best Regards,
Riad
Riad,
Where is this sc command located?
Thanks
Michael S.
Where is this sc command located?
Thanks
Michael S.
never mind, i see it's in the NT resource kit. Thanks.
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..
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.
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.
ASKER