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

pxfragonard

New member
Power User
VIP
Local time
1:47 PM
Messages
339
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 My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
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 My Computers

  • At a glance

    Windows 11 Pro x64 [Latest Release and Releas...Ryzen 9 5950X, 3.8 - 5.2 MHz64GB [2 x 32GB] DDR4 3200MHz4GB NVIDIA GEFORCE GTX 1650 Ti
    Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    ChillBlast - Custom to my design
    OS
    Windows 11 Pro x64 [Latest Release and Release Preview]
    CPU
    Ryzen 9 5950X, 3.8 - 5.2 MHz
    Motherboard
    Asus Prime X570-Pro
    Memory
    64GB [2 x 32GB] DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti
    Sound Card
    On-board SPDIF to 5.1 System + HDMI [5.1 system]
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160 @60Hz
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Workstation Case [Matt Black]
    Cooling
    NZXT Kraken X63 280mm CPU Cooler +2x Quiet Case fans
    Keyboard
    Logitech Wireless MX Keys & K400 + others
    Mouse
    Logitech Wireless MX Master 3S
    Internet Speed
    920 MB Down 50 MB Up
    Antivirus
    BitDefender Total Security Pro
    Browser
    Chrome (always run latest Non-Beta)
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    Samsung 10.2" tablet
    Blackview TAB 8 4G Android Tablet c/w Keyboard
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control
  • At a glance

    Windows 11 Pro x64 Latest RPIntel I7 10750H 5.0GHz32GB [2x16GB] DDR4 2933 MHznVidia GTX1650Ti 4 GB GDDR6
    Computer type
    Laptop
    System Manufacturer/Model Number
    Dell XPS 17 10750H
    OS
    Windows 11 Pro x64 Latest RP
    CPU
    Intel I7 10750H 5.0GHz
    Motherboard
    Dell XPS
    Memory
    32GB [2x16GB] DDR4 2933 MHz
    Graphics Card(s)
    nVidia GTX1650Ti 4 GB GDDR6
    Sound Card
    Stock [Realtek] 4 Speaker
    Monitor(s) Displays
    17" IPS UHD+ Infinity Edge Touchscreen
    Screen Resolution
    3840 x 2400
    Hard Drives
    2TB M2 NVMe, 4TB External + various 500GB & 1TB External NVMe (also have access to spinner HDD from
    PSU
    Stock
    Case
    Stock XPS Aluminium & Carbon Fibre
    Cooling
    Stock - Active Fan Control
    Keyboard
    Backlit + Various Logitech
    Mouse
    Stock Track Pad + Logitech MX Trackball
    Internet Speed
    72 MB Down 18MB Up
    Browser
    Chrome
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    10.2" tablet
    Sony Z3 Android Smartphone
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
    10TB NAS
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 My Computer

At a glance

Windows 7 Pro 32Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz4,00 GB (Usable 2,98)NVIDIA NVS 5100M
Computer type
Laptop
Computer Manufacturer/Model Number
HP Elitebook 8540p
OS
Windows 7 Pro 32
CPU
Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz
Motherboard
Hewlett-Packard 1521
Memory
4,00 GB (Usable 2,98)
Graphics Card(s)
NVIDIA NVS 5100M
Sound Card
NVIDIA High Definition Audio
Screen Resolution
1600x900
Hard Drives
INTEL SSDSA2CW120G3
Antivirus
F-Secure Internet Security
Browser
IE, Firefox, Opera
Other Info
Sandboxie,
SRP (Software Restriction Policy),
EMET (Enhanced Mitigation Experience Toolkit),
WFC (Windows Firewall Control by BiniSoft),
Malwarebytes Premium

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
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 My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
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! :D
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz6 GBRadeon 6750 1gb
Computer Manufacturer/Model Number
HP Pavilion p6745f
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Motherboard
PEGATRON CORPORATION 2AB6
Memory
6 GB
Graphics Card(s)
Radeon 6750 1gb
Sound Card
(1) IDT High Definition Audio CODEC (2) Intel(R) Display A
Monitor(s) Displays
Acer x193w
Hard Drives
(1) WDC WD15EARS-60MVWB0 (2) Generic- Compact Flash USB Device (3) Generic- MS/MS-Pro USB Device (4) Generic- SD/MMC USB Device (5) Generic- SM/xD-Picture USB Device (6) WD My Book 1110 USB Device
PSU
Internal 500W (100V-240V)
Case
Mid-size ATX
Cooling
unknown
Keyboard
HP usb multimedia keyboard
Mouse
HP usb compliant mouse
Internet Speed
256 kbps
Other Info
Ver: CHI_713.bin vCHI7.13
Back
Top