将下面代码复制到txt文件中,然后修改文件后缀为bat(不懂改后缀百度一下。)
@echo off
echo for each ps in GetObject("winmgmts:\\.\root\cimv2:win32_process").instances_>___L_.vbs
echo WScript.Echo f(ps.handle,5)^&f(ps.name,15)^&ps.executablepath:Next>>___L_.vbs
echo Function f(str,n):f=str:for i=1 to n-len(str):f=f^&" ":Next:End Function>>___L_.vbs
cscript //nologo ___L_.vbs | find /V "cscript.exe" | find /V "find.exe" >C:\_proc_list.txt
del ___L_.vbs
findstr "StudentMain.exe" C:\_proc_list.txt
echo.
echo 请输入一行文字中的StudentMain前面的数字然后按回车确认,
echo (一般是4位数字),如果没有数字,说明监控未开,关闭退出。
set /p cmd=
if "%cmd%"==0 del C:\_proc_list.txt && goto :EOF
call :Tmnt %cmd%
del C:\_proc_list.txt
goto :EOF
:Tmnt
:start
if %1.==. goto :EOF
type C:\_proc_list.txt | find "%1" >nul && start /B ntsd -c q -p %1
shift
goto start
goto :EOF
标签:StudentMain,exe