Board logo

标题: [原创] vbs文件守护 [打印本页]

作者: LJY4.0    时间: 2022-7-24 18:52     标题: vbs文件守护

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




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2