Solved Is it possible to end a task/process using a .bat file in Windows 11?


Stormbow

Member
Local time
9:27 AM
Posts
5
Location
Arizona
OS
Windows 11
Windows 11 Version 22H2 (OS Build 22621.1265)

One of my favorite things about Windows 7 was using .bat files to close all processes associated with whatever I was doing— after saving my work, where applicable of course. It was one of my life's simple joys to click one thing— actually, I press 1 macro key on my keyboard, which executed a .bat file —and close the game I was playing, my voice controls for the game, my voice chat program, and any other related software.

An example of my old .bat file looked like this:
Batch:
@echo off
@echo Terminating chosen processes...

taskkill/F /IM "game.dll"
taskkill/F /IM "voicebot.exe"
taskkill/F /IM "discord.exe"
taskkill/F /IM "hotkeynet.exe"

exit
But since I've finally skipped Windows 8 and 10 to jump straight into 11, I find this .bat file doesn't work anymore.

Is it possible to accomplish this same feat in Windows 11? Could someone please provide me with a .bat file example, if it is?

Many thanks for reading, and for any help anyone may be able to offer.
 
Windows Build/Version
Windows 11 Version 22H2 (OS Build 22621.1265)

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    ORIGIN PC Genesis
    CPU
    AMD Ryzen 5 5600X 6-Core 3.7GHz (4.6GHz Max Boost)
    Motherboard
    MSI MEG B550 Unify
    Memory
    64GB CORSAIR VENGEANCE RGB RT 3200MHz (4x16GB)
    Graphics Card(s)
    AMD Radeon™ RX 6700 XT
    Sound Card
    None ☹
    Monitor(s) Displays
    24" Sceptre (don't ever buy these)
    Screen Resolution
    1920×1080
    Hard Drives
    2TB Samsung 970 EVO Plus PCIe NVMe
    PSU
    CORSAIR CS750 SERIES PLUS GOLD
    Case
    Corsair 7000D Airflow
    Cooling
    iCUE H150i ELITE CAPELLIX Liquid CPU Cooler
    Keyboard
    Logitech G510
    Mouse
    Redragon
    Internet Speed
    240 Mbps ↓ 7 Mbps ↑
    Browser
    Microsoft Edge
    Antivirus
    I, too, like to live dangerously.
    Other Info
    I'm not happy with the video card because it doesn't support my favorite screensaver. ☹
    I desperately need more SDD space. ☹
Cmd shell (batch file) commands work the same in Windows 11. I would put a space between "TaskKill" and "/F", but that does not appear to be the issue.

We need to see error messages. Open a Cmd prompt and try each of those individual commands and see if you get any error messages.

BTW, killing is not the same as closing. Programs should be closed properly whenever possible to avoid open handles that may lead to other issues or even data corruption. Yes, for some processes you can get away with killing without any adverse effects, but it's not a good habit in general.
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
  • Like
Reactions: OAT
As LesFerch stated, it'd be easier if you take a screenshot of you trying to run that so we can see the exact errors.

I'm thinking it's the *.dll that you're trying to kill that is giving you the error.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro β
    Computer type
    Laptop
    Manufacturer/Model
    HP Pavilion Laptop 15-eg0070wm
    CPU
    Intel® Core™ i7-1165G7
    Memory
    32 GB DDR4-3200 SDRAM
    Graphics Card(s)
    Intel® Iris® Xᵉ Graphics
    Screen Resolution
    1920x1080
    Hard Drives
    2TB PCIe® NVMe™ M.2 SSD
  • Operating System
    macOS Ventura
    Computer type
    PC/Desktop
    Manufacturer/Model
    Apple iMac 27" 5K (2017)
    CPU
    3.4 GHz Quad-Core Intel Core i5
    Memory
    40 GB 2400 MHz DDR4
    Graphics card(s)
    Radeon Pro 570 4 GB
    Monitor(s) Displays
    27" 5K, 34" UW
    Screen Resolution
    Mon 1: 5120 × 2880 Mon 2: 2560 x 1080
    Hard Drives
    32GB NVME, 1TB SSD
Be sure to run the batch file with administrative privileges.

Ben
 

My Computer

System One

  • OS
    Windows 10 Home
    Computer type
    Laptop
    Manufacturer/Model
    HP Elitebook 2530p
    CPU
    Intel Core 2 Duo L9400@1.86 GHz
    Memory
    2 GB
Wouldn't you know it... As soon as I finally ask someone for help with it, I figured it out— for some reason I'd changed from using "name.exe" to "window name" in the new /bat files, and that was 100% of why it didn't work. I should know better than to attempt to recreate things from (failing) memory. LOL 😅

Thank you all very much for attempting to assist me! I do appreciate it very much.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    ORIGIN PC Genesis
    CPU
    AMD Ryzen 5 5600X 6-Core 3.7GHz (4.6GHz Max Boost)
    Motherboard
    MSI MEG B550 Unify
    Memory
    64GB CORSAIR VENGEANCE RGB RT 3200MHz (4x16GB)
    Graphics Card(s)
    AMD Radeon™ RX 6700 XT
    Sound Card
    None ☹
    Monitor(s) Displays
    24" Sceptre (don't ever buy these)
    Screen Resolution
    1920×1080
    Hard Drives
    2TB Samsung 970 EVO Plus PCIe NVMe
    PSU
    CORSAIR CS750 SERIES PLUS GOLD
    Case
    Corsair 7000D Airflow
    Cooling
    iCUE H150i ELITE CAPELLIX Liquid CPU Cooler
    Keyboard
    Logitech G510
    Mouse
    Redragon
    Internet Speed
    240 Mbps ↓ 7 Mbps ↑
    Browser
    Microsoft Edge
    Antivirus
    I, too, like to live dangerously.
    Other Info
    I'm not happy with the video card because it doesn't support my favorite screensaver. ☹
    I desperately need more SDD space. ☹

Latest Support Threads

Back
Top Bottom