Code

source: dvdvideosoft.freestudio/CLIENT_DATA/browserkill.vbs @ 5199bf

Revision 5199bf, 864 bytes checked in by geos_one, 5 years ago (diff)

close brwoser windows

  • Property mode set to 100644
Line 
1Option Explicit
2KillBrowsers()
3
4Sub KillBrowsers()
5'Declare variables
6    Dim i
7    Dim wmiSvc,WQL,Processes,Process
8    Dim arrBrowserProcesses(7)
9
10'Initialize variables
11    arrBrowserProcesses(0)="iexplore.exe"
12    arrBrowserProcesses(1)="chrome.exe"
13    arrBrowserProcesses(2)="firefox.exe"
14    arrBrowserProcesses(3)="safari.exe"
15    arrBrowserProcesses(4)="opera.exe"
16    arrBrowserProcesses(5)="iron.exe"
17    arrBrowserProcesses(6)="MicrosoftEdge.exe"
18
19    Set wmiSvc = GetObject("winmgmts:\\.\root\cimv2")
20    For i = 0 To UBound(arrBrowserProcesses)
21        wql = "SELECT * FROM Win32_Process WHERE Name='" & arrBrowserProcesses(i) & "'"
22        Set processes = wmiSvc.ExecQuery(wql)
23        Do While processes.Count > 0
24            For Each process In processes
25                process.Terminate
26            Next
27            WScript.Sleep 200
28            Set processes = wmiSvc.ExecQuery(wql)
29        Loop
30    Next
31
32End Sub
33
Note: See TracBrowser for help on using the repository browser.