Jump to content
thedexmonster

Simple program to kill a program

Recommended Posts

Can someone help me with a very simple program that can run in the background?

I need to kill a task based on a filename whenever it starts. I am running Windows 10 x64 if it matters.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.


×
×
  • Create New...