skip to Main Content

I’m trying to produce a batch file that can check to see if a process is running such as a game, photoshop, or media and terminate a specific process. In this case ‘f.lux’ considering it dims the screen and can affect color quality. I’ve looked for some answers on here for this with no luck, as most of the content is older and I’m not sure how much has changed in Windows 10. So far here is what I have picked up off of some other posts.

tasklist /FI "IMAGENAME eq example_process.exe" 2>NUL | find /I /N "example_process.exe">NUL
if "%ERRORLEVEL%"=="0" taskkill /im f.lux.exe

Not sure how correct this is, so any advice or help would be appreciated.
Thanks.

2

Answers


  1. taskkill /im f.lux.exe
    

    either this or

    taskkill /f /im f.lux.exe
    

    See taskkill/?

    Login or Signup to reply.
  2. Just change to your task to be killed instead of iexplore.exe task in this example :

    @echo off
    set task=iexplore.exe
    set Active_task=0
    for /f %%q In ('tasklist') DO (if /i "%%q" EQU "%task%" set Active_task=1)
    if %Active_task% EQU 1 (
        Taskkill /PID %task% /F
    )
    Pause
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search