I use a batch file to countdown and need to stop this countdown process in another batch file.
- I've tried to use these, but they all failed:
taskkill /f /fi "windowtitle eq countdown" taskkill /f /im countdown.cmd taskkill /f /fi "windowtitle eq counting down"
countdown.cmd
:Title %~n0 color 4F @echo off mode 32,10 title Timer echo Enter time to countdown from. set time=233 :loop cls set /a time=%time%-1 if %time%==0 goto timesup title Counting down... echo. echo. echo. echo Countdown - [%time%] ping localhost -n 2 > nul goto loop :timesup echo Time is Up! start %~dp0FocusApp.cmd goto end :end @exit
Administrator: countdown
respectivelyAdministrator: Counting down...
, notcountdown
, and the Image iscmd.exe
, notcountdown.cmd
. Better find the PID withtasklist /v | find "Counting down..." with a
for /f "tokens=2"` loop and thentaskkill /PID