none
Make a Desktop Shortcut From an Item in the Services List

    Question

  • Hello Windows7 Forum,

    I would like to as whether it is possible to create a desktop shortcut for a service from the Services.msc console. I have a few services that I run only when I require them. Rather than opening the Services.msc and starting the services when needed, then stopping the service when I'm done with it, is it possible to have that particular service as a desktop icon where I can double click it to get its' property prompt/dialog box that has the 'Start', 'Stop' buttons.

    For example, I have MySQL installed. In order to use MySQL databases and the MySQL Workbench I need to start the MySQL service. When I'm done I stop the service. I would like to do this from an icon/shortcut immediately available. There are a few other services I'd like to do this for too.

    Not a show stopper nor a problem, more a matter of convenience. Any tips are very much appreciated.

     

    Thanks and regards,

     - BotRot


    BotRot
    Saturday, September 03, 2011 12:50 AM

Answers

  • Create two batch files with the code snippets below:

    Stop MySQL.bat - net stop MySQLService
    Start MySQL.bat - net start MySQLService

    I don't know the exact name of the service, but you can update that.


    If you found this post helpful, please give it a "Helpful" vote. If it answered your question, remember to mark it as an "Answer".

    Rich Prescott | MCITP, MCTS, MCP

    [Blog] Engineering Efficiency | Twitter: @Rich_Prescott | Powershell Client System Administration tool
    • Marked as answer by nj-c Saturday, September 03, 2011 12:15 PM
    Saturday, September 03, 2011 1:12 AM
  • or......... if you just want one batch file which turns it off if its started and starts it if is stopped

    save below as whatever.bat

     

    @ECHO OFF
    
    REM Checking Service state
    REM replace bolded service variable below with the service you want to start or stop
    net start MySQLservice 2>nul
    if errorlevel 2 goto AlreadyRunning
    if errorlevel 1 goto Error
    
    
    REM  Service started
    
    GOTO ContinueWithBatch
    
    :AlreadyRunning
    REM  Service is already running
    REM replace bolded service below with the service you want to start or stop
    net stop MySQLservice
    GOTO ContinueWithBatch
    
    :Error
    REM  Service failed to start
    GOTO ContinueWithBatch
    
    :ContinueWithBatch
    

     


    Regards, ~P MCSE, MCITP, MCTS, MCP, CCNA

    • Edited by Gandalf50 Saturday, September 03, 2011 9:36 AM bolded variables
    • Marked as answer by nj-c Saturday, September 03, 2011 12:15 PM
    Saturday, September 03, 2011 1:44 AM

All replies

  • Create two batch files with the code snippets below:

    Stop MySQL.bat - net stop MySQLService
    Start MySQL.bat - net start MySQLService

    I don't know the exact name of the service, but you can update that.


    If you found this post helpful, please give it a "Helpful" vote. If it answered your question, remember to mark it as an "Answer".

    Rich Prescott | MCITP, MCTS, MCP

    [Blog] Engineering Efficiency | Twitter: @Rich_Prescott | Powershell Client System Administration tool
    • Marked as answer by nj-c Saturday, September 03, 2011 12:15 PM
    Saturday, September 03, 2011 1:12 AM
  • or......... if you just want one batch file which turns it off if its started and starts it if is stopped

    save below as whatever.bat

     

    @ECHO OFF
    
    REM Checking Service state
    REM replace bolded service variable below with the service you want to start or stop
    net start MySQLservice 2>nul
    if errorlevel 2 goto AlreadyRunning
    if errorlevel 1 goto Error
    
    
    REM  Service started
    
    GOTO ContinueWithBatch
    
    :AlreadyRunning
    REM  Service is already running
    REM replace bolded service below with the service you want to start or stop
    net stop MySQLservice
    GOTO ContinueWithBatch
    
    :Error
    REM  Service failed to start
    GOTO ContinueWithBatch
    
    :ContinueWithBatch
    

     


    Regards, ~P MCSE, MCITP, MCTS, MCP, CCNA

    • Edited by Gandalf50 Saturday, September 03, 2011 9:36 AM bolded variables
    • Marked as answer by nj-c Saturday, September 03, 2011 12:15 PM
    Saturday, September 03, 2011 1:44 AM
  • Helpful replies!

    Gandalf50 - Can you please bold or italic the variables in the code? It's a little confusing to figure out which places the service name has to be replaced, thanks!


    Kunal D Mehta - a Windows Server Enthusiast | My first TechNet Wiki Article
    Saturday, September 03, 2011 9:27 AM
  • There you go. bolded and italicized!!
    Regards, ~P MCSE, MCITP, MCTS, MCP, CCNA
    Saturday, September 03, 2011 9:41 AM
  • Thank you all for your solutions, I now know the wonderful world of batch commands and processes.

    And the bold-italic fonts made it just that little bit easier to understand. Thanks again all (whom responded).

     

    Thanks and regards,

     - BotRot


    BotRot
    Saturday, September 03, 2011 12:21 PM