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 x3, 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




Similar help and support threads
Thread Forum
Task Scheduler: Batch file stuck in 'running' status
I need to run a batch file using the System account when a user logs on. This is needed for Crashplan to see network drives, following the tip at The Crashplan Network Drive Workaround My batch file does the following: net use r: \\server\folder1 net use s: \\server\folder2 I have created...
Performance & Maintenance
Insufficient Memory Errors running Batch file
I have a batch file that . . . 1. reads a txt file that contains a list of filename prefixes. 2. drills down thru a folder tree looking for filesnames beginning with each of those prefixes. 3. copies (XCOPY) each matching file into a new folder tree (with matching subfolder...
General Discussion
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
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


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 08:38.
Twitter Facebook Google+