Forum Discussion
Batch File That TaskKill Won't Stop
I have the following Windows 11 batch file that I run, and then below it I have my batch file that I attempt to kill it with. I have searched Google and ChatGPT several time and tried all the solutions as you will see below. Any help appreciated! Here is the batch file:
:: Echo off
title MY_LOOP_SCRIPT
:loop
echo Running batch files at %date% %time%
:: Run first batch file
:: call "C:\Path\To\FirstScript.bat"
:: Run second batch file
:: call "C:\Path\To\SecondScript.bat"
taskkill /F /IM FMP24.exe
taskkill /F /IM DSDplus.exe
taskkill /F /IM Orbitron.exe
taskkill /F /IM SDRSharp.exe
taskkill /F /IM xwxtoimg.exe
taskkill /F /IM SDRSharpDriverDDE*
REM ------------------------------------------------------------------------------------------------------------------------------
REM Password = 2A9AgFnar4wwvvUt5Pja
REM Downloaded TO: C:\_Files\SDR - Software Defined Radio\sdrsharp-x86
REM File Name Format = DSDPlus2p*.*
REM value window = 1 console 2 source audio 4 channel activity 8 event log
REM Sum values to minimize windows
REM ------------------------------------------------------------------------------------------------------------------------------
REM - P25 Trunking - 1 dongle solution
REM ------------------------------------------------------------------------------------------------------------------------------
CHDIR C:\_FILES\SDR - Software Defined Radio\sdrsharp-x86\dsd+FASTLANE-p25
DELETE DSDPlus.bin
START FMP24 -rc -i1 -o20001 -P0.0 -f853.9625 -g47 -b12.5
REM add -_2 to minimize window!
START DSDPlus -r1 -e -T -E -Pwav -i20001 -O NUL -_1
REM Remove the _1 to display a list of files that have been checked!
REM -------------------------------------------------------------------------------------------------------------------------------
REM - DMR
REM -------------------------------------------------------------------------------------------------------------------------------
REM CHDIR C:\_Files\SDR - Software Defined Radio\sdrsharp-x86\dsd+FASTLANE-DMR-Working-Conventional-Scanning
REM DELETE DSDPlus.bin
REM START FMP24 -i3 -o20009 -P0.0 -s1 -v150 -_2 -g47
REM START DSDPlus -e -fa -i20009 -m1 -_15 -O NUL
REM -------------------------------------------------------------------------------------------------------------------------------
REM Z - z-FM2 ScanList
REM -------------------------------------------------------------------------------------------------------------------------------
REM CHDIR C:\_Files\SDR - Software Defined Radio\sdrsharp-x86\dsd+FASTLANE-FMN Scanner\Z - SCANNER 2
REM TIMEOUT 1
REM DELETE DSDPlus.bin
REM START FMP24 -i2 -P0.0 -s1 -o20008 -wsl0.0 -n2 -g47 -_2
REM START DSDPlus -e -fa -i20008 -m1 -_15 -O NUL
REM -------------------------------------------------------------------------------------------------------------------------------
REM -i = input device (radio number)
REM -f = Initial tuned frequency
REM -P = PPM value
REM -s = Enable/disable scanner mode
REM -o = Output device (port or speakers)
REM -wsl = Spectrum window location
REM -g = RF gain (dB) [max]
REM -_ = Minimize windows at startup; bitmapped
REM -n = Select noise filter (0-2)
echo Done. Waiting 30 minutes...
:: Wait 900 seconds (15 minutes)
timeout /t 900 /nobreak >nul
goto loop
--------------------------------------------------------------------
NOW FOR THE BATCH FILE THAT I ATTEMPT TO STOP IT WITH:
---------------------------------------------------------------------
taskkill /F /IM FMP24.exe
taskkill /F /IM DSDplus.exe
taskkill /F /IM Orbitron.exe
taskkill /F /IM SDRSharp.exe
taskkill /F /IM xwxtoimg.exe
taskkill /F /IM SDRSharpDriverDDE*
taskkill /F /IM Terminal
taskkill /IM cmd.exe /F
wmic process where "CommandLine like 'MY_LOOP_SCRIPT'" delete
taskkill /FI WINDOWTITLE eq "MY_LOOP_SCRIPT" /F
taskkill /F /IM Z - ZZ - START JANE's Feed.bat
taskkill /f /im cmd.exe /fi "WINDOWTITLE eq Z - ZZ - START JANE's Feed.bat"
taskkill /f /im cmd.exe
4 Replies
- James_AlexanderNTin Contributor
This kills only the batch with that exact title and leaves other Command Prompt windows untouched.
The loop keeps running because the batch file is not a process image; it is being executed by cmd.exe. Several stop commands therefore target the wrong thing, and killing every cmd.exe instance could terminate unrelated consoles. Since your script already sets title MY_LOOP_SCRIPT, use the title as a precise filter: taskkill /F /T /FI "WINDOWTITLE eq MY_LOOP_SCRIPT". The quotation marks must surround the complete filter expression. /T also ends child processes started by that command process. Test first with tasklist /FI "WINDOWTITLE eq MY_LOOP_SCRIPT" so you can confirm exactly what will be selected. Do not use the batch filename with /IM, because it is not an executable image, and avoid the unrestricted taskkill /IM cmd.exe /F. If the child applications survive, stop them separately by their exact executable names. Finally, the posted script contains a password-like value; remove it and rotate it if it is real
- jkreskiCopper Contributor
Thanks for the try but the solution did not work, at least I couldn't get it to work...
- azirahhammia8Copper Contributor
You are right.