How to kill specific VBScript using batch file?
@echo off
set vbs="%temp%\dummy.vbs"
for /f "usebackq tokens=2" %%s in (`WMIC path Win32_Process where 'name="wscript.exe"' get commandline,processid | findstr /i /c:"%vbs%"`) do (
taskkill /f /fi "pid eq %%s"
)
I also tried the code below but it seems that commandline like is not working.
WMIC path Win32_Process where "name='wscript.exe' and commandline like %vbs%" get processid
Thanks in advance!