标题: [原创] vbs文件守护 [打印本页]
作者: LJY4.0 时间: 2022-7-24 18:52 标题: vbs文件守护
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
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |