How to make two shortcuts: Enable+Start service & Disable+Stop any windows service?












2














But at this time I need only shortcuts for windows update service. I don't keep windows update service running all time but windows store needs windows update service running. I want to enable+start windows update service before opening windows store with shortcut and disable+stop windows update service after closing windows store.



I found some good answers to restart a service here : https://stackoverflow.com/questions/1995847/desktop-shortcut-to-restart-a-windows-service



Any help will be useful for me and people with same need.



WORKED FOR ME: (windows 10)



I created two text files & paste those one line code in each (see accepted answer)



I changed those files extension to .bat



I created 2 shortcuts for both files



I edited those 2 shortcuts to run as admin, > right click on shortcut > click "properties" > go to "shortcut" tab > click "advanced" > tick "run as administrator" > OK > OK



INFO: to get any service name. Go to "services" > right click any service > properties > see service name.










share|improve this question





























    2














    But at this time I need only shortcuts for windows update service. I don't keep windows update service running all time but windows store needs windows update service running. I want to enable+start windows update service before opening windows store with shortcut and disable+stop windows update service after closing windows store.



    I found some good answers to restart a service here : https://stackoverflow.com/questions/1995847/desktop-shortcut-to-restart-a-windows-service



    Any help will be useful for me and people with same need.



    WORKED FOR ME: (windows 10)



    I created two text files & paste those one line code in each (see accepted answer)



    I changed those files extension to .bat



    I created 2 shortcuts for both files



    I edited those 2 shortcuts to run as admin, > right click on shortcut > click "properties" > go to "shortcut" tab > click "advanced" > tick "run as administrator" > OK > OK



    INFO: to get any service name. Go to "services" > right click any service > properties > see service name.










    share|improve this question



























      2












      2








      2


      2





      But at this time I need only shortcuts for windows update service. I don't keep windows update service running all time but windows store needs windows update service running. I want to enable+start windows update service before opening windows store with shortcut and disable+stop windows update service after closing windows store.



      I found some good answers to restart a service here : https://stackoverflow.com/questions/1995847/desktop-shortcut-to-restart-a-windows-service



      Any help will be useful for me and people with same need.



      WORKED FOR ME: (windows 10)



      I created two text files & paste those one line code in each (see accepted answer)



      I changed those files extension to .bat



      I created 2 shortcuts for both files



      I edited those 2 shortcuts to run as admin, > right click on shortcut > click "properties" > go to "shortcut" tab > click "advanced" > tick "run as administrator" > OK > OK



      INFO: to get any service name. Go to "services" > right click any service > properties > see service name.










      share|improve this question















      But at this time I need only shortcuts for windows update service. I don't keep windows update service running all time but windows store needs windows update service running. I want to enable+start windows update service before opening windows store with shortcut and disable+stop windows update service after closing windows store.



      I found some good answers to restart a service here : https://stackoverflow.com/questions/1995847/desktop-shortcut-to-restart-a-windows-service



      Any help will be useful for me and people with same need.



      WORKED FOR ME: (windows 10)



      I created two text files & paste those one line code in each (see accepted answer)



      I changed those files extension to .bat



      I created 2 shortcuts for both files



      I edited those 2 shortcuts to run as admin, > right click on shortcut > click "properties" > go to "shortcut" tab > click "advanced" > tick "run as administrator" > OK > OK



      INFO: to get any service name. Go to "services" > right click any service > properties > see service name.







      windows windows-10 cmd.exe shortcuts services






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 23 '17 at 12:41









      Community

      1




      1










      asked Jan 1 '17 at 6:24









      BlackFire

      222217




      222217






















          2 Answers
          2






          active

          oldest

          votes


















          2














          How do I enable/start and stop/disable the Windows Update Service from cmd?



          You can do this using sc commands.




          • Either assign the commands to a shortcut or add them to a batch file and assign the batch file to a shortcut.

          • To do the same with any other service replace wuauserv with the service name.


          Enable/Start:



          sc config wuauserv start= auto & sc start wuauserv


          Stop/Disable:



          sc stop wuauserv & sc config wuauserv start= disabled


          Example output:



          > sc config wuauserv start= auto & sc start wuauserv
          [SC] ChangeServiceConfig SUCCESS

          SERVICE_NAME: wuauserv
          TYPE : 20 WIN32_SHARE_PROCESS
          STATE : 2 START_PENDING
          (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
          WIN32_EXIT_CODE : 0 (0x0)
          SERVICE_EXIT_CODE : 0 (0x0)
          CHECKPOINT : 0x0
          WAIT_HINT : 0x7d0
          PID : 1204
          FLAGS :

          > sc stop wuauserv & sc config wuauserv start= disabled

          SERVICE_NAME: wuauserv
          TYPE : 20 WIN32_SHARE_PROCESS
          STATE : 3 STOP_PENDING
          (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
          WIN32_EXIT_CODE : 0 (0x0)
          SERVICE_EXIT_CODE : 0 (0x0)
          CHECKPOINT : 0x1
          WAIT_HINT : 0x7530
          [SC] ChangeServiceConfig SUCCESS




          Further Reading





          • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


          • sc - Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE.






          share|improve this answer























          • Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
            – BlackFire
            Jan 2 '17 at 16:16










          • @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
            – DavidPostill
            Jan 2 '17 at 16:21












          • @BlackFire No problem. My fault for not thinking about the corner cases ...
            – DavidPostill
            Jan 2 '17 at 18:28



















          1














          On Windows:

          - Right click the desktop.

          - Select "New->Shortcut" from the menu to create a shortcut.

          - Instead of the location of the item, in the "Type the location of the item" dialog box enter your Command Prompt arguments.



          Once the shortcut has been created:

          - Right click the shortcut to go to "Properties".

          - Select "Advanced" option in the "Shortcut" tab and tick "Run as administrator".






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1162229%2fhow-to-make-two-shortcuts-enablestart-service-disablestop-any-windows-servi%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            How do I enable/start and stop/disable the Windows Update Service from cmd?



            You can do this using sc commands.




            • Either assign the commands to a shortcut or add them to a batch file and assign the batch file to a shortcut.

            • To do the same with any other service replace wuauserv with the service name.


            Enable/Start:



            sc config wuauserv start= auto & sc start wuauserv


            Stop/Disable:



            sc stop wuauserv & sc config wuauserv start= disabled


            Example output:



            > sc config wuauserv start= auto & sc start wuauserv
            [SC] ChangeServiceConfig SUCCESS

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 2 START_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x0
            WAIT_HINT : 0x7d0
            PID : 1204
            FLAGS :

            > sc stop wuauserv & sc config wuauserv start= disabled

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 3 STOP_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x1
            WAIT_HINT : 0x7530
            [SC] ChangeServiceConfig SUCCESS




            Further Reading





            • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


            • sc - Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE.






            share|improve this answer























            • Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
              – BlackFire
              Jan 2 '17 at 16:16










            • @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
              – DavidPostill
              Jan 2 '17 at 16:21












            • @BlackFire No problem. My fault for not thinking about the corner cases ...
              – DavidPostill
              Jan 2 '17 at 18:28
















            2














            How do I enable/start and stop/disable the Windows Update Service from cmd?



            You can do this using sc commands.




            • Either assign the commands to a shortcut or add them to a batch file and assign the batch file to a shortcut.

            • To do the same with any other service replace wuauserv with the service name.


            Enable/Start:



            sc config wuauserv start= auto & sc start wuauserv


            Stop/Disable:



            sc stop wuauserv & sc config wuauserv start= disabled


            Example output:



            > sc config wuauserv start= auto & sc start wuauserv
            [SC] ChangeServiceConfig SUCCESS

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 2 START_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x0
            WAIT_HINT : 0x7d0
            PID : 1204
            FLAGS :

            > sc stop wuauserv & sc config wuauserv start= disabled

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 3 STOP_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x1
            WAIT_HINT : 0x7530
            [SC] ChangeServiceConfig SUCCESS




            Further Reading





            • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


            • sc - Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE.






            share|improve this answer























            • Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
              – BlackFire
              Jan 2 '17 at 16:16










            • @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
              – DavidPostill
              Jan 2 '17 at 16:21












            • @BlackFire No problem. My fault for not thinking about the corner cases ...
              – DavidPostill
              Jan 2 '17 at 18:28














            2












            2








            2






            How do I enable/start and stop/disable the Windows Update Service from cmd?



            You can do this using sc commands.




            • Either assign the commands to a shortcut or add them to a batch file and assign the batch file to a shortcut.

            • To do the same with any other service replace wuauserv with the service name.


            Enable/Start:



            sc config wuauserv start= auto & sc start wuauserv


            Stop/Disable:



            sc stop wuauserv & sc config wuauserv start= disabled


            Example output:



            > sc config wuauserv start= auto & sc start wuauserv
            [SC] ChangeServiceConfig SUCCESS

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 2 START_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x0
            WAIT_HINT : 0x7d0
            PID : 1204
            FLAGS :

            > sc stop wuauserv & sc config wuauserv start= disabled

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 3 STOP_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x1
            WAIT_HINT : 0x7530
            [SC] ChangeServiceConfig SUCCESS




            Further Reading





            • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


            • sc - Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE.






            share|improve this answer














            How do I enable/start and stop/disable the Windows Update Service from cmd?



            You can do this using sc commands.




            • Either assign the commands to a shortcut or add them to a batch file and assign the batch file to a shortcut.

            • To do the same with any other service replace wuauserv with the service name.


            Enable/Start:



            sc config wuauserv start= auto & sc start wuauserv


            Stop/Disable:



            sc stop wuauserv & sc config wuauserv start= disabled


            Example output:



            > sc config wuauserv start= auto & sc start wuauserv
            [SC] ChangeServiceConfig SUCCESS

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 2 START_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x0
            WAIT_HINT : 0x7d0
            PID : 1204
            FLAGS :

            > sc stop wuauserv & sc config wuauserv start= disabled

            SERVICE_NAME: wuauserv
            TYPE : 20 WIN32_SHARE_PROCESS
            STATE : 3 STOP_PENDING
            (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
            WIN32_EXIT_CODE : 0 (0x0)
            SERVICE_EXIT_CODE : 0 (0x0)
            CHECKPOINT : 0x1
            WAIT_HINT : 0x7530
            [SC] ChangeServiceConfig SUCCESS




            Further Reading





            • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.


            • sc - Service Control - Create, Start, Stop, Query or Delete any Windows SERVICE.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 2 '17 at 16:24

























            answered Jan 1 '17 at 13:42









            DavidPostill

            103k25222256




            103k25222256












            • Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
              – BlackFire
              Jan 2 '17 at 16:16










            • @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
              – DavidPostill
              Jan 2 '17 at 16:21












            • @BlackFire No problem. My fault for not thinking about the corner cases ...
              – DavidPostill
              Jan 2 '17 at 18:28


















            • Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
              – BlackFire
              Jan 2 '17 at 16:16










            • @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
              – DavidPostill
              Jan 2 '17 at 16:21












            • @BlackFire No problem. My fault for not thinking about the corner cases ...
              – DavidPostill
              Jan 2 '17 at 18:28
















            Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
            – BlackFire
            Jan 2 '17 at 16:16




            Thanks. I found one thing when the service is automatic + not running, then disable shortcut is not working. Its working when automatic + running
            – BlackFire
            Jan 2 '17 at 16:16












            @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
            – DavidPostill
            Jan 2 '17 at 16:21






            @BlackFire Ah. That is because the stop fails. Change the && to & and it will run the second command even if the first command fails. I've updated the answer.
            – DavidPostill
            Jan 2 '17 at 16:21














            @BlackFire No problem. My fault for not thinking about the corner cases ...
            – DavidPostill
            Jan 2 '17 at 18:28




            @BlackFire No problem. My fault for not thinking about the corner cases ...
            – DavidPostill
            Jan 2 '17 at 18:28













            1














            On Windows:

            - Right click the desktop.

            - Select "New->Shortcut" from the menu to create a shortcut.

            - Instead of the location of the item, in the "Type the location of the item" dialog box enter your Command Prompt arguments.



            Once the shortcut has been created:

            - Right click the shortcut to go to "Properties".

            - Select "Advanced" option in the "Shortcut" tab and tick "Run as administrator".






            share|improve this answer




























              1














              On Windows:

              - Right click the desktop.

              - Select "New->Shortcut" from the menu to create a shortcut.

              - Instead of the location of the item, in the "Type the location of the item" dialog box enter your Command Prompt arguments.



              Once the shortcut has been created:

              - Right click the shortcut to go to "Properties".

              - Select "Advanced" option in the "Shortcut" tab and tick "Run as administrator".






              share|improve this answer


























                1












                1








                1






                On Windows:

                - Right click the desktop.

                - Select "New->Shortcut" from the menu to create a shortcut.

                - Instead of the location of the item, in the "Type the location of the item" dialog box enter your Command Prompt arguments.



                Once the shortcut has been created:

                - Right click the shortcut to go to "Properties".

                - Select "Advanced" option in the "Shortcut" tab and tick "Run as administrator".






                share|improve this answer














                On Windows:

                - Right click the desktop.

                - Select "New->Shortcut" from the menu to create a shortcut.

                - Instead of the location of the item, in the "Type the location of the item" dialog box enter your Command Prompt arguments.



                Once the shortcut has been created:

                - Right click the shortcut to go to "Properties".

                - Select "Advanced" option in the "Shortcut" tab and tick "Run as administrator".







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 1 at 11:53









                Gabriel

                33




                33










                answered Jul 21 '17 at 9:34









                Nathan

                111




                111






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1162229%2fhow-to-make-two-shortcuts-enablestart-service-disablestop-any-windows-servi%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Сан-Квентин

                    8-я гвардейская общевойсковая армия

                    Алькесар