-1

My windows in generating many chrome.exe lines in the processes tab. Even when I close chrome those lines still appear.

I tried using taskkill /F /IM chrome.exe /T but no help, It just closing the chrome but those many lines are still there in the processes tab.

taskkill /F /IM chrome.exe /T

Is there a way to kill all those chrome.exe lines ?

Gerhard
  • 22,678
  • 7
  • 27
  • 43
  • I just tried it and it works fine. What is the content of the "Username" column in task manager for those Chrome sessions? Do you have any error message when you launch the commands in a prompt? – Dominique May 13 '19 at 09:24

1 Answers1

0

Maybe your script is not killing all instances, so try this

:kill
taskkill /F /IM chrome.exe /T
IF ERRORLEVEL 128 goto kill

Based on What are exit codes from the taskkill utility?, I'm testing for "no such process" error and repeating until we don't get that error.

Danger: this may cause an infinite loop if taskkill is failing for some reason. Tell us more context, so we can advise on other conditions to terminate the above loop. Here is a very simple basic way to stop after trying the kill command 20 times

counter=0

:kill
set /a cycles=cycles+1
taskkill /F /IM chrome.exe /T

if %cycles%==20 goto endlocal
IF ERRORLEVEL 128 goto kill

:endlocal
echo Ran taskkil %cycles% times

Let us know how it works