CODE: [Copy to clipboard]
@echo off
md D:\test
echo.>D:\test\test.txt
start D:\test\test.txt
rem 以上创建D:\test\test.txt并打开D:\test\test.txt
for /f "tokens=2,3 delims=," %%i in ('wmic process get ProcessId^,CommandLine /format:csv^|find /v "find"^|find /i "D:\test\test.txt"') do set PID=%%j
taskkill.exe /PID %PID%
rd /s /q D:\test\
pause
CODE: [Copy to clipboard]
@echo off
md D:\test 2>nul
start /min cmd /k cd D:\test
start /min cmd /k cd D:\test
for /f "tokens=2,3 delims=," %%i in ('wmic process get ProcessId^,CommandLine /format:csv^|find /v "find"^|find /i "D:\test"') do call set pid=%%pid%% /pid %%j
taskkill.exe /f %PID%
rd /s /q D:\test\
pause