Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch file to start and stop servic
Name: niksu444 Date: October 30, 2007 at 22:21:55 Pacific OS: Windows XP CPU/Ram: Intel P4 Product: Dell
Comment:
Hi!
I need a batch file to start and stop some specifig service. The service could be in example messenger.
I have now tried to make it with the guide of http://www.ss64.com/nt/sc.html which guides me to make it using SC and FIND command. And managed to get this kind of code:
SC query messenger | FIND "STATE" goto task%errorlevel% :task0 NET STOP messenger goto end :task1 NET START messenger :end exit
for some reason this aint working. The errorlevel status doesnt change. It is the same still even if the service is on or off.
Can this be done in some other way, or is there something I am doing wrong?
Name: Razor2.3 Date: October 30, 2007 at 22:29:22 Pacific
Reply:
Try this (untested):
NET START messenger ||NET STOP messenger
0
Response Number 2
Name: niksu444 Date: November 6, 2007 at 21:36:13 Pacific
Reply:
Yes it worked!
Thank you very much, should always first try to look simple answers :D
0
Response Number 3
Name: Sweetheart Date: November 16, 2007 at 12:18:04 Pacific
Reply:
I have a somwhat similar problem. Need to stop a service while running a backup. When I Net Stop "Service" it responds with a message that a running service is dependent on it--we knew--and wants a "Y" or "N" to continue. How can I work the answer into the batch file so it is an unattended PRE-Command for Backup Exec?
Summary: I need a batch file to open folders in c:TempFonts and then move and delete any .ttf files therein to s:Projects\_fonts. I am a newbie to DOS batch files and any help will be greatly appreciated. Than...
Summary: Have a text file that has about 100 Entries that look like this. ["Brumak"] = { ["class"]="Death Knight", ["dkp"]=12.00, ["dkp_1"]=12.00, }, Yes, this is a WoW Macro, I'm a Huge do...
Summary: Hej! i am new at dos batch files, so i need your help to notice what i am doing wrong. I have built a .NET program called JLMail which can send mail from command line, so i can execute from cmd promp...