如果你的new.bat不会改变title,你可以在启动时指定一个title,再根据这个title结束进程。- start "new.bat" new.bat
- sleep
- taskkill /f /fi "WINDOWTITLE eq new.bat*"
复制代码 或者直接使用wmic- @echo off
- for /f %%a in ('wmic process where "name='cmd.exe'" get processid^,commandline^|find /i "new.bat"^|find /i /v "find"') do for %%i in (%%a) do set pid=%%i
- taskkill /f /pid %pid%
复制代码
- wmic process where "commandline like '%new.bat%'" delete
复制代码 第二个wmic代码Win2000不可用。
[ 本帖最后由 zqz0012005 于 2009-3-20 14:39 编辑 ] |