VB编写的VBS如何防止别人结束进程
答案:3 悬赏:50 手机版
解决时间 2021-02-20 11:59
- 提问者网友:不爱我么
- 2021-02-19 17:09
打开了VBS后就结束不掉此进程
最佳答案
- 五星知识达人网友:走死在岁月里
- 2021-02-19 18:44
在你的脚本中加入:strComputer = "."
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")objProcess.Create("wscript.exe C:\PRO.VBS")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancedeletionevent " _
& "within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
if instr(ucase(objLatestProcess.TargetInstance.commandline),"C:\PRO.VBS") then
objProcess.Create("wscript.exe C:\PRO.VBS")
end if
Loop
其中C:\PRO.VBS就是起保护作用的脚本路径,你可以自行建立(C:\PRO.VBS必须要大写) 现在新建一个保护脚本,路径和上面的C:\PRO.VBS要一致strComputer = "."
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancedeletionevent " _
& "within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
if instr(ucase(objLatestProcess.TargetInstance.commandline),"C:\TEST.VBS") then
objProcess.Create("wscript.exe C:\TEST.VBS")
end if
Loop其中C:\TEST.VBS,就是你的主脚本路径,根据实际情况该写,但是C:\TEST.VBS需要大写 直接运行你的主脚本C:\TEST.VBS即可,不需要你手动运行保护脚本
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")objProcess.Create("wscript.exe C:\PRO.VBS")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancedeletionevent " _
& "within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
if instr(ucase(objLatestProcess.TargetInstance.commandline),"C:\PRO.VBS") then
objProcess.Create("wscript.exe C:\PRO.VBS")
end if
Loop
其中C:\PRO.VBS就是起保护作用的脚本路径,你可以自行建立(C:\PRO.VBS必须要大写) 现在新建一个保护脚本,路径和上面的C:\PRO.VBS要一致strComputer = "."
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancedeletionevent " _
& "within 1 where TargetInstance isa 'Win32_Process'")
i = 0
Do While i = 0
Set objLatestProcess = colMonitoredProcesses.NextEvent
if instr(ucase(objLatestProcess.TargetInstance.commandline),"C:\TEST.VBS") then
objProcess.Create("wscript.exe C:\TEST.VBS")
end if
Loop其中C:\TEST.VBS,就是你的主脚本路径,根据实际情况该写,但是C:\TEST.VBS需要大写 直接运行你的主脚本C:\TEST.VBS即可,不需要你手动运行保护脚本
全部回答
- 1楼网友:躲不过心动
- 2021-02-19 19:17
你要是Vb生成Vbs就开个时钟,进程一没有就重新启动!
再看看别人怎么说的。
- 2楼网友:愁杀梦里人
- 2021-02-19 19:06
这个比较困难,VBS脚本是由脚本解释器解释执行的,如果要实现不能被结束进程,那就要让脚本解释器不能被结束,但是这需要调用不少系统API函数,恐怕VBS脚本无力胜任。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯