Board logo

标题: 批处理监视进程 [打印本页]

作者: 115322023     时间: 2010-9-9 22:43    标题: 批处理监视进程

我要监视的进程比如是,1,2,3里面的某一个


@echo off
if "%1"=="h" goto begin
start mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
::隐藏窗口
:begin
echo wscript.sleep 2000 >%temp%\sl.vbs
::输出暂停程序,暂停2000毫秒
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v sysstart /t REG_SZ /d %windir%\unstat.vbs /f >nul
::修改注册表,自启动
echo set objShell=wscript.createObject("wscript.shell")>%windir%\unstat.vbs
echo iReturn=objShell.Run("cmd.exe /C %windir%\unstat.bat", 0, TRUE)>>%windir%\unstat.vbs
copy /y %0 %windir%\unstat.bat
:run
tasklist | find /i "explorer.exe" || goto do
::没有发现进程就转向标签do
cscript //nologo %temp%\sl.vbs
::暂停2秒,减小占用系统资源
goto run
:do
shutdown /r /f /t 0
::立即强制重启。如果想蓝屏把上一行换为:ntsd -c q -pn winlogon.exe



使用批处理结束掉进程,1,2,3
ntsd -c q -p  452 (1的PID)
ntsd -c q -pn 2
ntsd -c q -pn 3
作者: 115322023     时间: 2010-9-10 13:34
求人帮忙
作者: DXSX     时间: 2010-9-10 16:33
每10秒钟探测一次 系统进程,并根据 tk.txt 中记载的进程影像名 中断进程。
tk.txt 的内容 包括 WORD /IE /QQ ,也就是说 可以监测并中断 word/ie/qq的运行。
所需命令:tasklist/taskkill /ping /for /if  和 color/mode/title

@echo off
title killtask from tk.txt
mode con: cols=40 lines=10
color f1
:loop
for /f %%c in (tk.txt) do (
  tasklist /fi "IMAGENAME eq %%c" 2>nul |find /i "%%c" >nul 2>nul
  if not errorlevel 1 (
    taskkill /im %%c /t /f >nul
    if not errorlevel 1  (echo %time% 关闭%%c OK!) else (echo %time% 关闭%%c Error!)
  )
)
ping 127.0.0.1 -n 10 >nul
goto loop
:end

tk.txt 的内容:
iexplore.exe
winword.exe
qq.exe

[ Last edited by DXSX on 2010-9-10 at 16:35 ]
作者: 115322023     时间: 2010-9-10 22:25
我想要的是一个开机启动的
我才刚刚接触批处理   不懂的太多
作者: DXSX     时间: 2010-9-12 08:37
还是自己研究吧。
不要浮躁,静下心来,世界都是你的,没什么难的。
http://hi.baidu.com/dxsx/blog/item/1d13ecfa8c5915dfb48f316b.html
http://hi.baidu.com/dxsx/blog/item/9a49400f70a8c9286059f33d.html
作者: 115322023     时间: 2010-9-14 17:37
各位大神
帮我一下

3L  偏以了主题
4L 我不能等了