How can I automatically restart, or close and then open, a specific application?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I've been playing a game that consistently crashes, but never during the first game. A workaround has been to completely close the game and then re-launch it, seemingly restarting the "game counter" back to 0.



Is it possible to write a simple script to automate this process? I'd imagine I need to kill the game + launcher processes, then open them after a short delay.










share|improve this question


















  • 1





    Yes, this is typically a very possible option. What have you tried? What research have you done? We're not a script writing service, so you'll need to start with research and attempts on your own, but once you've come up against something you're having trouble figuring out, we're here to help.

    – music2myear
    Mar 11 at 23:50











  • I appreciate where you're coming from, I just didn't know the right keywords to get started. After some stumbling around "batch scripts" seemed to be what I was looking for. Code posted below!

    – Stn
    Mar 12 at 0:06






  • 1





    Nicely done. For not know what it was called you've figured it out rather quickly. Next thing you know you'll be an IT pro...

    – music2myear
    Mar 12 at 0:07













  • I actually remembered creating a batch file in high school (opened Notepad, wrote "name.bat" and saved as "name.bat"; open to watch the command line endlessly scroll and feel like a badass hacker), so it was more of tip of my tongue situation! Thanks for commenting, I appreciate your time.

    – Stn
    Mar 12 at 0:20


















1















I've been playing a game that consistently crashes, but never during the first game. A workaround has been to completely close the game and then re-launch it, seemingly restarting the "game counter" back to 0.



Is it possible to write a simple script to automate this process? I'd imagine I need to kill the game + launcher processes, then open them after a short delay.










share|improve this question


















  • 1





    Yes, this is typically a very possible option. What have you tried? What research have you done? We're not a script writing service, so you'll need to start with research and attempts on your own, but once you've come up against something you're having trouble figuring out, we're here to help.

    – music2myear
    Mar 11 at 23:50











  • I appreciate where you're coming from, I just didn't know the right keywords to get started. After some stumbling around "batch scripts" seemed to be what I was looking for. Code posted below!

    – Stn
    Mar 12 at 0:06






  • 1





    Nicely done. For not know what it was called you've figured it out rather quickly. Next thing you know you'll be an IT pro...

    – music2myear
    Mar 12 at 0:07













  • I actually remembered creating a batch file in high school (opened Notepad, wrote "name.bat" and saved as "name.bat"; open to watch the command line endlessly scroll and feel like a badass hacker), so it was more of tip of my tongue situation! Thanks for commenting, I appreciate your time.

    – Stn
    Mar 12 at 0:20














1












1








1








I've been playing a game that consistently crashes, but never during the first game. A workaround has been to completely close the game and then re-launch it, seemingly restarting the "game counter" back to 0.



Is it possible to write a simple script to automate this process? I'd imagine I need to kill the game + launcher processes, then open them after a short delay.










share|improve this question














I've been playing a game that consistently crashes, but never during the first game. A workaround has been to completely close the game and then re-launch it, seemingly restarting the "game counter" back to 0.



Is it possible to write a simple script to automate this process? I'd imagine I need to kill the game + launcher processes, then open them after a short delay.







windows script cmd.exe






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 11 at 23:31









StnStn

164




164








  • 1





    Yes, this is typically a very possible option. What have you tried? What research have you done? We're not a script writing service, so you'll need to start with research and attempts on your own, but once you've come up against something you're having trouble figuring out, we're here to help.

    – music2myear
    Mar 11 at 23:50











  • I appreciate where you're coming from, I just didn't know the right keywords to get started. After some stumbling around "batch scripts" seemed to be what I was looking for. Code posted below!

    – Stn
    Mar 12 at 0:06






  • 1





    Nicely done. For not know what it was called you've figured it out rather quickly. Next thing you know you'll be an IT pro...

    – music2myear
    Mar 12 at 0:07













  • I actually remembered creating a batch file in high school (opened Notepad, wrote "name.bat" and saved as "name.bat"; open to watch the command line endlessly scroll and feel like a badass hacker), so it was more of tip of my tongue situation! Thanks for commenting, I appreciate your time.

    – Stn
    Mar 12 at 0:20














  • 1





    Yes, this is typically a very possible option. What have you tried? What research have you done? We're not a script writing service, so you'll need to start with research and attempts on your own, but once you've come up against something you're having trouble figuring out, we're here to help.

    – music2myear
    Mar 11 at 23:50











  • I appreciate where you're coming from, I just didn't know the right keywords to get started. After some stumbling around "batch scripts" seemed to be what I was looking for. Code posted below!

    – Stn
    Mar 12 at 0:06






  • 1





    Nicely done. For not know what it was called you've figured it out rather quickly. Next thing you know you'll be an IT pro...

    – music2myear
    Mar 12 at 0:07













  • I actually remembered creating a batch file in high school (opened Notepad, wrote "name.bat" and saved as "name.bat"; open to watch the command line endlessly scroll and feel like a badass hacker), so it was more of tip of my tongue situation! Thanks for commenting, I appreciate your time.

    – Stn
    Mar 12 at 0:20








1




1





Yes, this is typically a very possible option. What have you tried? What research have you done? We're not a script writing service, so you'll need to start with research and attempts on your own, but once you've come up against something you're having trouble figuring out, we're here to help.

– music2myear
Mar 11 at 23:50





Yes, this is typically a very possible option. What have you tried? What research have you done? We're not a script writing service, so you'll need to start with research and attempts on your own, but once you've come up against something you're having trouble figuring out, we're here to help.

– music2myear
Mar 11 at 23:50













I appreciate where you're coming from, I just didn't know the right keywords to get started. After some stumbling around "batch scripts" seemed to be what I was looking for. Code posted below!

– Stn
Mar 12 at 0:06





I appreciate where you're coming from, I just didn't know the right keywords to get started. After some stumbling around "batch scripts" seemed to be what I was looking for. Code posted below!

– Stn
Mar 12 at 0:06




1




1





Nicely done. For not know what it was called you've figured it out rather quickly. Next thing you know you'll be an IT pro...

– music2myear
Mar 12 at 0:07







Nicely done. For not know what it was called you've figured it out rather quickly. Next thing you know you'll be an IT pro...

– music2myear
Mar 12 at 0:07















I actually remembered creating a batch file in high school (opened Notepad, wrote "name.bat" and saved as "name.bat"; open to watch the command line endlessly scroll and feel like a badass hacker), so it was more of tip of my tongue situation! Thanks for commenting, I appreciate your time.

– Stn
Mar 12 at 0:20





I actually remembered creating a batch file in high school (opened Notepad, wrote "name.bat" and saved as "name.bat"; open to watch the command line endlessly scroll and feel like a badass hacker), so it was more of tip of my tongue situation! Thanks for commenting, I appreciate your time.

– Stn
Mar 12 at 0:20










1 Answer
1






active

oldest

votes


















1














Figured it out. Here's my code, saved into filename.bat.



@echo
cls
taskkill /IM [name].exe /T /F
taskkill /IM [name].exe /T /F
timeout /T 5
cd "[PATH]"
Start "" /b [name].exe
exit





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%2f1413248%2fhow-can-i-automatically-restart-or-close-and-then-open-a-specific-application%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Figured it out. Here's my code, saved into filename.bat.



    @echo
    cls
    taskkill /IM [name].exe /T /F
    taskkill /IM [name].exe /T /F
    timeout /T 5
    cd "[PATH]"
    Start "" /b [name].exe
    exit





    share|improve this answer




























      1














      Figured it out. Here's my code, saved into filename.bat.



      @echo
      cls
      taskkill /IM [name].exe /T /F
      taskkill /IM [name].exe /T /F
      timeout /T 5
      cd "[PATH]"
      Start "" /b [name].exe
      exit





      share|improve this answer


























        1












        1








        1







        Figured it out. Here's my code, saved into filename.bat.



        @echo
        cls
        taskkill /IM [name].exe /T /F
        taskkill /IM [name].exe /T /F
        timeout /T 5
        cd "[PATH]"
        Start "" /b [name].exe
        exit





        share|improve this answer













        Figured it out. Here's my code, saved into filename.bat.



        @echo
        cls
        taskkill /IM [name].exe /T /F
        taskkill /IM [name].exe /T /F
        timeout /T 5
        cd "[PATH]"
        Start "" /b [name].exe
        exit






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 12 at 0:04









        StnStn

        164




        164






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1413248%2fhow-can-i-automatically-restart-or-close-and-then-open-a-specific-application%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

            Index of /

            Tribalistas

            Listed building