@echo off SETLOCAL EnableDelayedExpansion :: List of processes to check set processesToKill=komorebi.exe whkd.exe :: Loop through each process in the list for %%A in (%processesToKill%) do ( :: Check if the process is running tasklist /FI "IMAGENAME eq %%A" 2>NUL | find /I /N "%%A" >NUL if "!errorlevel!"=="0" ( echo Killing process: %%A taskkill /F /IM %%A ) else ( echo Process not running: %%A ) ) komorebic start -c %USERPROFILE%\komorebi.json --whkd