madbull Posted December 21, 2007 Posted December 21, 2007 I was wondering if anyone new how to stop and disable a service using a batch script.I know you can delete, view etc usinc the "sc" command but i'm unsure if this can be used to disable a service.Thanks.Another thing regarding batch files and command line programs (shutdown, sc, user etc) say i want to use shutdown.exe but i do not have it in my "system32" folder but i do have a copy of it on my memeory stick (e:\) can i point to it using a batch file.eg:cd e: shutdown.exe (variables/options here).Thanks again,
Arie Posted December 21, 2007 Posted December 21, 2007 I was wondering if anyone new how to stop and disable a service using a batch script.I know you can delete, view etc usinc the "sc" command but i'm unsure if this can be used to disable a service.NET STOP "ServiceName"Another thing regarding batch files and command line programs (shutdown, sc, user etc) say i want to use shutdown.exe but i do not have it in my "system32" folder but i do have a copy of it on my memeory stick (e:\) can i point to it using a batch file.If the file is in the same folder as the batch script, there is no need to specify the path to the file. If the file is not in the same folder as the batch script and the path to the file cannot change, you could simply launch it via START. For options, launch START /?. If the path can change, which is the case with most USB sticks as they're plug and play, you could alter the CD-ROM drive discovery script to always point at the correct USB drive. See the Unattended Guide here for the script.
madbull Posted December 21, 2007 Author Posted December 21, 2007 (edited) I was wondering if anyone new how to stop and disable a service using a batch script.I know you can delete, view etc usinc the "sc" command but i'm unsure if this can be used to disable a service.NET STOP "ServiceName"Another thing regarding batch files and command line programs (shutdown, sc, user etc) say i want to use shutdown.exe but i do not have it in my "system32" folder but i do have a copy of it on my memeory stick (e:\) can i point to it using a batch file.If the file is in the same folder as the batch script, there is no need to specify the path to the file. If the file is not in the same folder as the batch script and the path to the file cannot change, you could simply launch it via START. For options, launch START /?. If the path can change, which is the case with most USB sticks as they're plug and play, you could alter the CD-ROM drive discovery script to always point at the correct USB drive. See the Unattended Guide here for the script.Wow thanks Arie,I completly forgot about the "net stop" command although i have never used this one anyway.But i will use this now, also i was wondering what the "net.exe" files main function is i have looked at tye help part using "cmd" it looks like it has multiple functions.Also i am aware of the "net1.exe" file and was wondering whether this has anything to do with the "net.exe" file.Thanks for all of the information you have supplied me,PS. I am under the impression you know your batch files and commands, i was wondering if you would be able to help:http://www.msfn.org/board/index.php?showtopic=109578 - removing a non empty directory. Edited December 21, 2007 by madbull
halaxa Posted December 21, 2007 Posted December 21, 2007 (edited) If you want to also kill any process, you can usetaskkillyou can type taskkill /?for more options Edited December 21, 2007 by halaxa
madbull Posted December 21, 2007 Author Posted December 21, 2007 If you want to also kill any process, you can usetaskkillyou can type taskkill /?for more optionsThanks for that one. Has come in usefull already.
Mordac85 Posted December 21, 2007 Posted December 21, 2007 I was wondering if anyone new how to stop and disable a service using a batch script.I know you can delete, view etc usinc the "sc" command but i'm unsure if this can be used to disable a service.You can use SC to start/stop a service as well as disable it.sc stop spoolersc config spooler start= disabledReturns: [SC] ChangeServiceConfig SUCCESSJust beware that the space between the equal sign and disabled is not a typo. SC will bomb out if you don't use it.
madbull Posted December 31, 2007 Author Posted December 31, 2007 Thanks to everyone for their replies,I am familiar with many of the suggested commands etc but have learnt alot of things that i didn't know and also advanced stuff about those that i did.Once again Thanks,
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now