All Forums >> [Scripting] >> WSH & Client Side VBScript >> find out if programm is running with VBScript Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I thought about a VBScript that can figure out if a programm is running and afterwards, if the programm is not running, start it. Is that possible, for e.g. with DivX Player or any other specific application running on windows?
The next code checks the running of a process Database.exe
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'Database.exe'") If colProcesses.Count = 0 Then Wscript.Echo "Database.exe is not running" Else Wscript.Echo "Database.exe is running." End If
The next code will start your program :
Set WshShell = WScript.CreateObject("WScript.Shell") Return = WshShell.Run("Database.exe", 1, true) You can try to combine these.