SQL Server Batch Files

  1. #1
    townsbg is offline Senior Member

    SQL Server Batch Files

    Ok so is anyone good with batch files? Lately I've been using batch files to control services & save memory & cpu use by using batch files to turn on/off services that I only need occasionally but that take up a fair amount to a lot of memory & have multiple services. I do this so that when I need these services I just run the batch file instead of going into the services control panel & start/stop them one at a time (it is more convenient this way). I create one to start the services & one to stop. Then in the file I use net start or stop & then the service name depending on what I'm doing. I also leave these services' startup on manual so that this will work. Understand this so far? By the way the full memory usage of the full version of sql server 2005 (which is the purpose of this thread) takes up over 300 mb so I DON'T want these running all of the time, but only when I am using them & there are 9 services to start/stop.

    The problem is that one of the sql server services switches it's startup from manual to automatic every time it is run which entirely defeats the purpose of doing this because I'll either have to run this batch file every time I log in/boot up or open up the services menu after running the batch file & change the start up back to manual after I am done.

    So my question is if anyone know how to change the service start up from automatic to manual using the command line? If I know how to do this then I can incorporate this into the stop services batch file & not have to change this in the services menu after I am done? If this can't be done in the command line then there a registry setting I can edit to prevent it from changing its start up status?

    Now I just want to thank MS for making this so complicated. Why does a service need to change its startup status after it is run? Have I been clear enough on this?
    Last edited by townsbg; 03-11-2009 at 05:02 PM.


+ Reply to Thread