Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
FindApp("opera.exe")
FindApp("iexplore.exe")
FindApp("FireFox.exe")
FindApp("chrome.exe")
FindApp("Safari.exe")
'FindApp+Kill_All.vbs
Const ForAppending=8
'Check if Wscript is running, we exit, otherwise we run the script
'Vérifie si Wscript est en cours d'exécution, on quitte, sinon on lance le script
If CheckIfWscriptIsRunning Then Wscript.Quit
WaitAndLoopForApp(10) '10 is the Number of seconds to wait to find an
' application to be Killed. We can increase this time.
' 10 est le Nombre de secondes d'attente pour rechercher une
' application à terminer. On peut augmenter cette durée.
Sub FindApp(strApp)
Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
set fich = fso.OpenTextFile("C:\Events.log",ForAppending,true) ' Fichier journal
Set SRVC = GetObject("winmgmts:\\")
Set ObjServ = SRVC.InstancesOf("Win32_Process")
For Each myObj In ObjServ
If LCase(myObj.Name) = LCase(strApp) Then
'Writing in the custom log file
'Ecriture dans le fichier journal personnalisé
Fich.Write myObj.Name +" is running but killed at : " & Now & vbnewline
' We close the application and we get out of the loop
' On ferme l'application et on sort de la boucle
IF Not (myObj Is Nothing) Then myObj.Terminate()
Exit For
End If
Next
Set ObjServ=Nothing
Set SRVC = Nothing
End Sub
Sub WaitAndLoopForApp(ByVal Sec)
start=timer
do
i=start+timer
loop until i-start>=Sec 'We wait a number of secodes to act ' On attend un nombre (sec) de secondes pour agir
If i-Start>=Sec then
Do
FindApp("opera.exe")
FindApp("iexplore.exe")
FindApp("FireFox.exe")
FindApp("chrome.exe")
FindApp("Safari.exe")
Wscript.Sleep 10000
Set WS=CreateObject("Wscript.Shell")
Com = "%SystemRoot%\System32\CScript.exe " & Wscript.ScriptFullName
Result=WS.Run(Com,0,True)
Loop
End If
End Sub
Function CheckIfWscriptIsRunning() ' Vérifie si Wscript tourne ou non
Set SRVC = GetObject("winmgmts:\\")
Set ObjServ = SRVC.InstancesOf("Win32_Process")
s=""
For Each myObj In ObjServ
If LCase(myObj.Name) = "wscript.exe" then
s= s+ myObj.name + VbCrLf
End If
OK=InsTr(1,s,VbCrLf+"wscript.exe",1) '>=1
Next
CheckIfWscriptIsRunning=OK
End Function
set objShell = CreateObject("Wscript.Shell")
set objWMI = GetObject("winmgmts:\\")
strFind = inputBox("What application do you want to terminate?")
set objExec = objShell.Exec("%comspec% /c tasklist.exe /v")
do until objExec.StdOut.AtEndOfStream
strLine = objExec.StdOut.ReadLine
if (instr(lcase(strLine), lcase(strFind))) then
msgbox strFind & " was found in line:" & vbNewLine & strLine
strProcess = trim(left(strLine, inStr(strLine, " ")))
msgbox "The process name is " & strProcess
if (msgbox("do you want to kill " & strProcess, vbYesNo) = vbYes) then
set objProcess = objWMI.InstancesOf("Win32_Process")
for each objItem in objProcess
if (lcase(objItem.Name) = lcase(strProcess)) then
msgbox "killing " & objItem.Name
objItem.terminate
end if
next
end if
end if
loop
what about sysinternals process explorer.Does anyone know how to find process for a specific application?