Create Batch File to Start or End Window Services

The windows environment can be easily changed by starting or ending various windows services. For example, this method can be used to easily shut down multiple services for a performance boost during game playing.

Update: This article was original crafted for XP; however, I continue to use this technique on my Windows 7 and Windows 8 systems. On more recent Windows systems, the batch file will need to be run as administrator.

Warning: Manipulating windows services can have unpredictable effects on your system. You should create a system restore point before experimenting.

We all want to tweak or windows systems to the extreme to get the quickest, most powerful system possible. Many people will disable multiple window services manually before game playing. What a pain!

Many times people forget what the services do or forget to restart the important ones. Services can be easily changed by creating batch files.

The important commands are the following:
NET START – starts the service
NET STOP – ends the service

For example:
NET STOP "Error Reporting Service"

Output: The Error Reporting Service service was stopped successfully.

Knowing the commands, one can now easily create batch files called something like beforegame.bat and aftergame.bat.

Before.bat would contain all the NET STOP commands to end the nonessential services.
After.bat would be exactly the same except all the NET STOP commands would be replaced with NET START commands to restart all the common services.

A sample of the before.bat file might look something like this:

NET STOP "Error Reporting Service"
NET STOP "FTP Publishing Service"
SET STOP "IIS Admin"
NET STOP "Messenger"

Likewise, the after.bat file might look something like this:

NET START "Error Reporting Service"
NET START "FTP Publishing Service"
SET START "IIS Admin"
NET START "Messenger"

You may wish to reference this: list of services that can be disabled.

If your system ever becomes unstable and you want to return the services to their default settings, the default settings for the windows services can be found here.

 

About David Kirk

David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
View more articles by David Kirk

The Conversation

Follow the reactions below and share your own thoughts.

  • savita

    Hi,

    I am using net start to start a service. but my service name has sqaure brackets soemthign like abc[32.0] and becuase of square braces its failing. does anyone know escapae sequence for this?

    many thanks
    savita.

    • ilaya

      can u help me bellow issue

      check the particular service running or not in all 100 servers.we need to check this using single server.

      • Sarit

        > You can Use SC command and Create a Bat Script to check some service is running on all 100 Servers.

  • ramr

    Would be nice to clearly add where those files should be located.

    Thks, Regards

    • leighw

      Does anyone know how to DISABLE a service (not just stop it) so that it wont start again on the next reboot? I have tried the following: –

      NET STOP “Service Name” (The service stops after a second or two)
      SC Config “Service Name” start= disabled

      But this error is produced on the second line: –

      [SC] OpenService FAILED 1060: The specified service does not exist as an installed service.

      Patently the service does exist as it was stopped successfully in the first line.

      Thanks, Leigh

      • mrxbubbles

        try double quotes on the second one around the service name

      • http://computerdoctorscottsboro.com Chris Robertson

        Get Anvir task manager free. It lets you change the setting and disable services.

  • Ravi

    Thanks, But how to Enable / Disable Windows Services using DOS.

    If the service is disabled, we cannot start the service using ” net start command ”

  • Anonymous

    Nice one, I think it could help me cos am having a work station with oracle, SAP and microsoft SQL Server

  • Anonymous

    Ya Finger Crossed,
    i Was looking for Same.
    Thanks,
    Ahmad

  • Anonymous

    I created batch file having this entry NET STOP “MSSQLSERVER” and it is prompting me to accept Y before execution.
    How can I correct this to make auto-execute?

    • Matt Cook

      Just a simple /y before the service name should do it.

      Example:

      NET STOP /y “Windows Cardspace”

  • Swati Gudla

    Hello Everyone,
    I am very new to windows services.
    My question is..
    Is there any DOS command to figure out the running services.
    To be specific i have a windows service like “my service” i need to check the service is running or not..Is there any command to execute and see the running services…
    I would really appreciate if some one can help me out to ….

    • Anonymous

      sc query “my service”

      and

      net start

      • ilaya

        hi sir,

        please find the below sceneraio and help me to fix this, request you to provide bat and script file for this.

        unix,windows

        We have more than 100 servers in our environment, each server we have seperate user account. Need to change the password for all 100 servers from one server.

        windows

        check the particular service running or not in all 100 servers.we need to check this using single server.

    • ilaya

      can u help me bellow issue

      check the particular service running or not in all 100 servers.we need to check this using single server.

  • ilaya

    check the particular service running or not in all 100 servers.we need to check this using single server using bat file

  • Mazz

    Wickidellic!

    • Fuzoukwu

      To list all running services in Win XP issue the following command at the prompt:
      C>tasklist
      Have not tried it on Vista but it is likely to work also

  • Mulani salim

    we can create and delete same file again and again after 2 minits ,because of that pc cant goes in ideal mode, or any other solution on that…

    • Chandralalprabu

      txs its working fine

  • http://www.facebook.com/lsdillard Spencer Dillard

    Worked like a charm — note that it should be NET START, not SET START. I do sharepoint dev occasionally, and being able to stop/start the 20 or so services is a major help — thanks a bunch

  • Demurphey

    what about NET START with arguments to start the service as a different user?

    • clazman

      Are you implying to have a service configuration based on a user? Then a
      “gaming” user configuration could then be created?

      Isn’t this already possible?

  • Nssworld

    I am getting following error…
    Any clue why it is happening

    System error 5 has occurred.

    Access is denied.

  • Satish

    Thanks… its useful

  • joao

    Hi dear

    I am new at working with windows scripting for batch but, I wonder if you could help by sendin a script that starts and then stops my DHCP SERVER?

    Thanks

  • VIpul

    Hi ,

    Thanks for the Above blog, it was very useful for me!!
    Appreciate!!

    Thanks,

  • Wendy Barnett

    I have created the .bat files. But how do you run/execute them?
    Also new to Windows (old Mianframe person)

  • David Kirk

    @Wendy – You can double-click the batch file to run it or your can simply type the name of the file from the command prompt (just like a .exe or .com file).

  • Chris Robertson

    I keep snippets of all the commands I learn. This one show how to start, stop and disable a service.

    @echo off
    Title Start stop disable a service

    set service=cisvc
    sc config %service% start= auto
    net start %service%
    sc config %service% start= demand
    sc config %service% start= disabled
    net stop %service%

    ::We don’t want to delete the service just now.
    ::sc delete %service%
    pause

  • Matt

    The help is appreciated.
    I still can’t believe I’d forgotten how to do this.
    As for disabling services: I tend to use services.msc for the GUI.
    sc config I believe is a command that can be used to disable/enable.

  • Yogesh T

    Hi,
    I need to create a batch file for automatic scheduling of IIS start/ stop everyday @ morning 8am. Can anyone help me out in this.

  • clazman

    How about setting a service to “manual” compared to setting it as “disabled”?

    I imagine that the operating system is always checking the status of EVERY service. Consequently, setting a questionable service to “manual” would not slow the operating system yet would still allow the use of the service if required by the user.

    In other words, how does the “manual” setting compare with the “disabled” setting?

  • Bil

    How to stop workstation service using this net stop command in a batch file. There is a message whether you want to stop the service or not (Y/N): and the script is stuck up at this point.

  • angelblade

    Ok, but the service is yet running.

    i have a batch file like this

    C:WINDOWSsystem32sc.exe config Service1 start= disabled
    net stop Service1

    C:WINDOWSsystem32sc.exe config Service2 start= disabled
    net stop Service2

    sc.exe disable the service at start =)

  • TexasTuner

    how would one write a .bat to start a set of services and a program, then when the program is closed the set of sevices are stopped