Jump to content

Simple program to kill a program


thedexmonster
 Share

Recommended Posts

Here is a loop that will check every 5 seconds if a executable is running, then kill it if found:

:loop
set "name=the name of your executable"
tasklist /FI "IMAGENAME eq %name%" 2>NUL | find /I /N "%name%">NUL
if "%ERRORLEVEL%"=="0" (
    taskkill /IM %name% /f
    TIMEOUT 5
    goto :loop

You cand adjust the time.

 

You can also use PsKill instead of taskkill:

https://docs.microsoft.com/en-us/sysinternals/downloads/pskill

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...