Created
November 15, 2017 14:59
-
-
Save npocmaka/c9d07d720228145ed7b628ec0a653e04 to your computer and use it in GitHub Desktop.
Kills chromedriver and chrome browsers started by selenium framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
set count=0 | |
for /f "usebackq tokens=* delims=" %%a in (`wmic process where "name='chrome.exe' and CommandLine like '%%--enable-automation%%'" get ProcessID /Format:value`) do ( | |
for /f "tokens=1,2 delims==" %%A in ("%%a") do ( | |
set /a count=count+1 | |
set "%%A[!count!]=%%B" | |
) | |
) | |
for /L %%# in (1;1;%count%) do ( | |
taskkill /pid !processId[%%#]! /f 1>nul 2>&1 | |
) | |
taskkill /im chromed* /f >nul 2>&1 | |
endlocal | |
for %%x in (%cmdcmdline%) do if /i "%%~x"=="/c" pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment