Stop service using batch file

I've searched Google, I've read other threads on this, but got no clear answer.

I'm in need of a batch file that will set a service's startup type to disabled AND immediately stop the service if it is currently running as well. I've never dealt with batch files before. How do I go about doing this?

I would also need some way of making the batch file run on every startup. I assume an easy way to do this would be to put a shortcut to the batch file to the startup menu in the start menu (I'm using classic start menu)
4 answers Last reply
More about stop service batch file
  1. EDIT - Just noticed this is for Windows 8. Not sure if this is at all relevant as I'm not familiar with Windows 8

    Batch files are simply lines of commands saved into a file with a ".bat" extension. Example - mystartup.bat.
    You can create and save these files using any text editor like notepad.
    Saving the file in your startup folder will have the batch file execute each time you boot your system.
    The command line for starting and/or stopping a service is as follows:

    net start <servicename>
    net stop <servicename>

    The command for setting a service start to disabled is as follows:

    sc config <servicename> start= disabled

    So if you wanted to shut down and disable a service called "indexing", you would create a batch file with the following two lines of code"

    net stop indexing
    sc config indexing start= disabled

    Note the spacing as apparently, it's required.

    -Wolf sends
  2. Thanks - though neither commands appear to be working. I see other batch files sometimes have @echo off at the start. Do I need any special commands like this as well?
  3. Again, I'm not familiar with Windows 8 so I can't say for sure. "@echo off" is just a command to hide the command line execution output and isn't really needed.

    -Wolf sends

    Edit: Based on what I found here, the commands should be the same (or very similar).
  4. Seems like several commands aren't working. I can't even net send myself a note.
Ask a new question

Read More

Windows 8 Start Menu Google