Can I set up a button to stop a batch file from running?


  1. Posts : 339
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #1

    Can I set up a button to stop a batch file from running?


    I have my machine set to hibernate at 2 AM in case I forget to turn it off. But sometimes I'll be up working or watching TV so I set up a batch file with a 60 second delay to abort it. Sometimes I'm in bed with a wireless mouse (no x rated pun intended) and no keyboard so I'll have to get up and press control+C and then y and enter to stop the hibernation.

    It would be really cool to have a button on the desktop I could just press to abort the batch file from running. Is that possible?
      My Computer


  2. Posts : 31,250
    Windows 11 Pro x64 [Latest Release and Release Preview]
       #2

    Simplest way would be a normal shortcut pointing to the batch file :)

    If you "need" a button take a look at a simple scripting system

    https://www.autoitscript.com/site/autoit/

    Of course there would be more of a learning curve with this
      My Computers


  3. Posts : 1,049
    Windows 7 Pro 32
       #3

    Instead of a button create another batch file that kills the first one:
    taskkill /FI "WINDOWTITLE eq HibernateMyPC"

    For the above example to work you have to put this line at the top of the other batch file:
    title HibernateMyPC


    Or why not simply click the red X at the top right of the batch window? That will kill it too
      My Computer


  4. Posts : 339
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #4

    Barman58 said:
    Simplest way would be a normal shortcut pointing to the batch file :)

    If you "need" a button take a look at a simple scripting system

    https://www.autoitscript.com/site/autoit/

    Of course there would be more of a learning curve with this
    Thanks very much. That IS a learning curve for the likes of me! But life is for learning!
      My Computer


  5. Posts : 339
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #5

    Tookeri said:
    Instead of a button create another batch file that kills the first one:
    taskkill /FI "WINDOWTITLE eq HibernateMyPC"

    For the above example to work you have to put this line at the top of the other batch file:
    title HibernateMyPC


    Or why not simply click the red X at the top right of the batch window? That will kill it too
    Oh, that's brilliant! I didn't realize clicking the red X would kill it. I'm gonna try that right now!
      My Computer


  6. Posts : 339
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #6

    pxfragonard said:
    Tookeri said:
    Instead of a button create another batch file that kills the first one:
    taskkill /FI "WINDOWTITLE eq HibernateMyPC"

    For the above example to work you have to put this line at the top of the other batch file:
    title HibernateMyPC


    Or why not simply click the red X at the top right of the batch window? That will kill it too
    Oh, that's brilliant! I didn't realize clicking the red X would kill it. I'm gonna try that right now!
    Uh... and it woykt! Supoyb! Thanks!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:52.
Find Us