DISQUS

Tech-Recipes: Create Batch File to Start or End Window Services | Batch file programming | Tech-Recipes

  • Anonymous · 4 years ago
    If you want to automize php scripts on Windows I recommend using VisualCron which is free. It works like cron on Linux and is more advanced than the task scheduler in Windows.

    You can check it out here: http://www.visualcron.com
  • bd · 4 years ago
    Exactly what I was looking for.
  • Anonymous · 4 years ago
    A very efficient way to manage services is Advanced Uninstaller.

    I like the fact that you can save a profile of services and apply it later. You can save your original service configuration and then experiment safely - if anything goes wrong, you can just restore the original configuration.
  • billvts · 3 years ago
    Is there a way that I can make a batch file start a service if it is stopped but stop it if it is started, if that makes sense?

    Any help would be greatly appreciated!
  • sl · 3 years ago
    how about:

    sc \servername STOP "Servicename"

    where sc is the service control utility in resource kit. You can use START to start a service and other switches to do the following:

    sc \servername config servicename start=(boot, system, auto, demand, disabled)
  • Anonymous · 3 years ago
    Sometimes you might run into a problem using the NET command. You may find yourself getting this error:

    'net' is not recognize as an internal or external command.

    When that happens, this usually indicates that there is a problem with your PATH setting. To fix this, while in a command prompt, type PATH and hit the [enter] key. Your PATH variable may be long or short, depending on what programs have modified it, what you've done, etc..

    What you need to do is make sure that you have C:WindowsSystem32 as the first location in the PATH line (assuming you are using WinXP). To fix the problem, type:

    PATH %SystemRoot%System32

    And add any other path locations that may already be listed before you modified the path. Separate each individual path location with a semi-colon ( ; ).

    I usually keep my path variable simple:

    PATH %SystemRoot%System32;%SystemRoot%;%SystemRoot%Progra~1;C:;D:;E:

    EDIT: Sometimes setting this through a command prompt will not work, as the PATH variable may automatically be reset to what it was before you modified it. If this is the case, you can change the path by the following alternative method (assuming you're using WinXP):

    Right-click on "My Computer" and choose "Properties"
    Click the "Advanced" tab
    Click the "Environment Variables" button
    In the "System Variables" box, click on "Path", and click "Edit"
    Make the changes to your path variable, then click "Ok"
    Click "Ok" to exit all dialog windows.

    This should save your PATH variable correctly.
  • savita · 11 months ago
    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.
  • ramr · 8 months ago
    Would be nice to clearly add where those files should be located.

    Thks, Regards
  • leighw · 8 months ago
    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 · 7 months ago
    try double quotes on the second one around the service name
  • Ravi · 6 months ago
    Thanks, But how to Enable / Disable Windows Services using DOS.

    If the service is disabled, we cannot start the service using '' net start command ''
  • malaa · 3 weeks ago
    Nice one, I think it could help me cos am having a work station with oracle, SAP and microsoft SQL Server
  • aarfie · 2 weeks ago
    Ya Finger Crossed,
    i Was looking for Same.
    Thanks,
    Ahmad