帮忙看看怎么能再优化一下,O(∩_∩)O谢谢- @echo off&setlocal enabledelayedexpansion
- set /a cont=-1
- for /f "delims= tokens=*" %%a in ('tasklist') do (
- if !cont! geq 1 (echo !cont! %%a ) else echo %%a
- set /a cont=cont+1
- )
- set /p flag=请输入你要结束的进程号:
- set /a cont=-1
- for /f %%a in ('tasklist') do (
- if !cont! geq 1 (echo !cont! %%a >>C:\tmp.txt) else echo %%a >>C:\tmp.txt
- set /a cont=cont+1
- )
- for /f "skip=2 tokens=1,2 delims= " %%b in (C:\tmp.txt) do (
- if %flag% equ %%b taskkill /f /im %%c
- )
- endlocal
- del C:\tmp.txt
- pause
复制代码
|