vbs代码(文件守护.vbs):- On Error Resume Next
- dim wmi,proc,procs,proname,flag,WshShell,fso,f
- set fso=CreateObject("Scripting.FileSystemObject")
- set WSHshell = wscript.createobject("wscript.shell")
- set f=fso.opentextfile("X.tmp",8)
- Do
- proname="cmd.exe"
- set wmi=getobject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
- set procs=wmi.execquery("select * from win32_process")
- flag=true
- for each proc in procs
- if strcomp(proc.name,proname)=0 then
- flag=false
- exit for
- end if
- next
- set wmi=nothing
- if flag then
- WshShell.Run "进程保护.bat",0,true
- end if
- loop
复制代码 bat代码(进程保护.bat):- @echo off
- set a=文件保护.vbs
- :loop
- tasklist|find /i "wscript.exe" ||start %a%>nul
- goto loop
复制代码 下载链接:https://wwm.lanzouq.com/i19J108c5cmf |