监控并中止QQ及QQgame进程 的vbs 脚本
来源:互联网 发布:c语言右移运算符 编辑:程序博客网 时间:2024/05/11 19:08
监控并中止QQ及QQgame进程,同样可以用于中断其他程序进程,只要将进程的name写入stop_qq.txt
'此脚本由 wscript.exe 脚本解析程序负责解析执行.
'此脚本是死循环程序,要中断此脚本只需要在STOP_QQ.TXT 中填入含有 “WSCRIPT.EXE” 内容的记录并保存(Ctrl+S),脚本会将自身中断。
'当程序中断以后再删除 "wscript.exe" 数据,以确保下次能够正常发挥作用。
on error resume next
Set os0=createobject("shell.application")
Set os=CreateObject("wscript.shell")
Set fs=CreateObject("scripting.filesystemobject")
Set wmi=GetObject("winmgmts://.")
pathx=fs.GetFile(WScript.scriptFullName).ParentFolder.Path
path0=fs.GetFile(WScript.scriptFullName).Path
Set path1=fs.GetSpecialFolder(1)
'--------------------------------------------------------------------------------
'----------------MAIN DO LOOP --------------------------------------------------
Do
'create_boot
Set d0=createobject("scripting.dictionary")
edit_d
stop_p
WScript.Sleep 5000
Loop
'---------------------------------------------------------------------------------
'-------安装启动项
Sub create_boot
If fs.FolderExists(path1&"/vbs") = False Then fs.CreateFolder path1&"/vbs"
fs.CopyFile path0 , path1&"/vbs/boot.vbs",True
If fs.FileExists(pathx&"/stop_qq.txt") Then fs.CopyFile pathx&"/vbs/stop_qq.txt" , path1&"/stop_qq.txt",true
os.RegWrite "HKLM/Software/Microsoft/Windows/CurrentVersion/Run/stop_qq", Chr(34)&path1&"/vbs/BOOT.vbs"+Chr(34)
End Sub
'---------------------------------------------------------------------------------
'----------将数据文件中的数据导入dictionary d0
sub edit_d
If fs.FileExists(pathx&"/stop_qq.txt") = False Then
build_f
End If
Set file1=fs.OpenTextFile(pathx&"/stop_qq.txt",1,false)
n=0
Do Until file1.AtEndOfLine
l1=Trim(file1.readline)
If l1 <> "" Then
d0.Add n,l1 'd0为公用 dictionary 所以在总程序中定义
n=n+1
End If
Loop
If n=0 Then build_f
End Sub
'---------------------------------------------------------------------------------
'-------创建数据文件
Sub build_f
Set file1=fs.OpenTextFile(pathx&"/stop_qq.txt",2,True)
file1.WriteLine "qq.exe"
file1.WriteLine "qqgame.exe"
file1.Close
End Sub
'---------------------------------------------------------------------------------
'--------中断进程
Sub stop_p
For Each item In d0.Items
Set p=wmi.execquery("select * from win32_process where name='"&item&"'")
For Each p0 In p
p0.terminate()
os0.MinimizeAll
os.popup "你不知道工作时间不允许运行此程序么?",1,"警告",64+0
Next
Next
End sub
'此脚本由 wscript.exe 脚本解析程序负责解析执行.
'此脚本是死循环程序,要中断此脚本只需要在STOP_QQ.TXT 中填入含有 “WSCRIPT.EXE” 内容的记录并保存(Ctrl+S),脚本会将自身中断。
'当程序中断以后再删除 "wscript.exe" 数据,以确保下次能够正常发挥作用。
on error resume next
Set os0=createobject("shell.application")
Set os=CreateObject("wscript.shell")
Set fs=CreateObject("scripting.filesystemobject")
Set wmi=GetObject("winmgmts://.")
pathx=fs.GetFile(WScript.scriptFullName).ParentFolder.Path
path0=fs.GetFile(WScript.scriptFullName).Path
Set path1=fs.GetSpecialFolder(1)
'--------------------------------------------------------------------------------
'----------------MAIN DO LOOP --------------------------------------------------
Do
'create_boot
Set d0=createobject("scripting.dictionary")
edit_d
stop_p
WScript.Sleep 5000
Loop
'---------------------------------------------------------------------------------
'-------安装启动项
Sub create_boot
If fs.FolderExists(path1&"/vbs") = False Then fs.CreateFolder path1&"/vbs"
fs.CopyFile path0 , path1&"/vbs/boot.vbs",True
If fs.FileExists(pathx&"/stop_qq.txt") Then fs.CopyFile pathx&"/vbs/stop_qq.txt" , path1&"/stop_qq.txt",true
os.RegWrite "HKLM/Software/Microsoft/Windows/CurrentVersion/Run/stop_qq", Chr(34)&path1&"/vbs/BOOT.vbs"+Chr(34)
End Sub
'---------------------------------------------------------------------------------
'----------将数据文件中的数据导入dictionary d0
sub edit_d
If fs.FileExists(pathx&"/stop_qq.txt") = False Then
build_f
End If
Set file1=fs.OpenTextFile(pathx&"/stop_qq.txt",1,false)
n=0
Do Until file1.AtEndOfLine
l1=Trim(file1.readline)
If l1 <> "" Then
d0.Add n,l1 'd0为公用 dictionary 所以在总程序中定义
n=n+1
End If
Loop
If n=0 Then build_f
End Sub
'---------------------------------------------------------------------------------
'-------创建数据文件
Sub build_f
Set file1=fs.OpenTextFile(pathx&"/stop_qq.txt",2,True)
file1.WriteLine "qq.exe"
file1.WriteLine "qqgame.exe"
file1.Close
End Sub
'---------------------------------------------------------------------------------
'--------中断进程
Sub stop_p
For Each item In d0.Items
Set p=wmi.execquery("select * from win32_process where name='"&item&"'")
For Each p0 In p
p0.terminate()
os0.MinimizeAll
os.popup "你不知道工作时间不允许运行此程序么?",1,"警告",64+0
Next
Next
End sub
- 监控并中止QQ及QQgame进程 的vbs 脚本
- 刷QQ群的VBS脚本
- 自动监控进程并启动的shell脚本
- 结束进程和重新启动的vbs脚本
- QQ快速申请(VBS脚本)
- 计算文件及字符串的VBS脚本
- 监控进程的shell脚本
- 简单的进程监控脚本
- 列进程杀进程的vbs脚本(wmi)
- [编程实例]vbs脚本删除桌面上的快捷方式腾讯QQ
- QQ自动登陆带自动缩小的vbs脚本
- VBS监控带计时器的网页 并完成自动计时
- 查找系统并中止该进程(Wmobile)
- vbs wscript.shell objShell.Run 字符串 脚本 定时监控链路质量并保存
- 转:中止进程的方法
- 用Shell脚本定时监控Linux下的进程状态并自动重启
- 自动下载并运行的VBS脚本代码
- aix系统中服务进程监控并自启动脚本
- vbs+hta 实现同时关闭多个系统进程
- 最常用的网络命令精萃
- css学习笔记(3)图文混排 分级 鼠标
- 管理和优化服务的vbs
- "=="和equals方法究竟有什么区别?
- 监控并中止QQ及QQgame进程 的vbs 脚本
- SNMP协议原语的C语言算法实现(一):Get
- ABAP:参数输入屏幕SELECTION-SCREEN中的事件
- SNMP协议原语的C语言算法实现(二):Set
- Windows 消息常量
- unix下的汉字处理问题
- C# Office开发
- String到底变了没有?
- XFocus Windows Internet 服务器安全配置