Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

04 Dec 2014   #1
pxfragonard

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 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 System SpecsSystem Spec
.
04 Dec 2014   #2
Barman58

Windows 10 Pro x64 x2 Windows 10 Enterprise x64, Ubuntu
 
 

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 System SpecsSystem Spec
04 Dec 2014   #3
Tookeri

Windows 7 Pro 32
 
 

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 System SpecsSystem Spec
.

04 Dec 2014   #4
pxfragonard

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by Barman58 View Post
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 System SpecsSystem Spec
04 Dec 2014   #5
pxfragonard

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by Tookeri View Post
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 System SpecsSystem Spec
04 Dec 2014   #6
pxfragonard

Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by pxfragonard View Post
Quote   Quote: Originally Posted by Tookeri View Post
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 System SpecsSystem Spec
Reply

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




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Windows 7 creating blank txt file after running a batch script
I have the following batch script @echo off setlocal enableextensions set "baseName=dnshistory" set "count=0" for /f "delims=%baseName%." %%a in (
General Discussion
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch file to start a service if the service is not running
Here what I want : if servicename is running, do nothing. if servicename is not running, then start servicename, then record the date and time. based on my search online, here is what I have so far: net start | find "servicename" > nul 2>&1
General Discussion
Batch file to stop services fails
Back in the good ol days of xp when I wanted to take my machine off the net and use it for music production I had a seperate hardware profile setup with lots of services (including all the networking ones) disabled. With vista I discovered microsoft had taken this ablity away. So I wrote a batch...
Performance & Maintenance
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
How to create a batch file that will move files based on the file type
How to create a batch file that will move files based on the file type? My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...
General Discussion


Our Sites

Site Links

About Us

Find 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 09:36.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App