Board logo

标题: [系统相关] vbs关闭重复打开的窗口(win7-win10-win11测试通过) [打印本页]

作者: ygqiang    时间: 4 天前 12:14     标题: vbs关闭重复打开的窗口(win7-win10-win11测试通过)

vbs关闭重复打开的窗口(win7-win10-win11测试通过)
  1. Do
  2.      Call guan()
  3.     WScript.Sleep 40000
  4.      '40秒调用一次关闭重复窗口
  5. Loop
  6. Sub guan()
  7.     Set Shell = CreateObject("Shell.Application")
  8.     Set Dict = CreateObject("Scripting.Dictionary")
  9.     Set Wins = Shell.Windows
  10.     For i=Wins.Count-1 To 0 step -1
  11.         If Instr(LCase(Wins(i).FullName),"\explorer.exe") Then
  12.             If Dict.Exists(Wins(i).LocationURL) Then
  13.                 Wins(i).Quit
  14.             Else
  15.                 Dict.Add Wins(i).LocationURL,True
  16.             End If
  17.         End If
  18.     Next
  19. End Sub
复制代码





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