G
Guest
hello.
I want to run a program when there is not an instance of a different program
running. I have a script, from the lovely mvps.org people which works a treat:
Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'wow.exe'")
If colProcesses.Count = 0 Then
WshShell.Run chr(34) & _
"%Programfiles%\boinc\boincmgr.exe" & Chr(34)
End If
I have this set up to run (minimised) every hour using task scheduler, but
it will open multiple instances of boinc. What do I need to add so it wont
start boinc if it is already running?
And I need boinc to start minimised. I tried linking to a shortcut but the
batch wouldnt run it and also -min (actual boinc command) would not work in
the batch file, either boinc.exe -min" or after " -min.
I imagine its only one or two lines of code, I have looked on internet but
cant find much specific.
thanks
I want to run a program when there is not an instance of a different program
running. I have a script, from the lovely mvps.org people which works a treat:
Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'wow.exe'")
If colProcesses.Count = 0 Then
WshShell.Run chr(34) & _
"%Programfiles%\boinc\boincmgr.exe" & Chr(34)
End If
I have this set up to run (minimised) every hour using task scheduler, but
it will open multiple instances of boinc. What do I need to add so it wont
start boinc if it is already running?
And I need boinc to start minimised. I tried linking to a shortcut but the
batch wouldnt run it and also -min (actual boinc command) would not work in
the batch file, either boinc.exe -min" or after " -min.
I imagine its only one or two lines of code, I have looked on internet but
cant find much specific.
thanks