
vbs關閉重復打開的窗口win7win10win11測試通過vbs關閉重復打開的窗口(win7-win10-win11測試通過)
nclick="copycode($('code0'));">復制代碼
- Do
- Call guan()
- Wscript.Sleep 40000
- '40秒調用一次關閉重復窗口
- Loop
- Sub guan()
- Set Shell = CreateObject(Shell.Application)
- Set Dict = CreateObject(scripting.Dictionary)
- Set Wins = Shell.Windows
- For i=Wins.Count-1 To 0 step -1
- If Instr(LCase(Wins(i).FullName),explorer.exe) Then
- If Dict.Exists(Wins(i).LocationURL) Then
- Wins(i).Quit
- Else
- Dict.Add Wins(i).LocationURL,True
- End If
- End If
- Next
- End Sub

