PC Review


Reply
Thread Tools Rate Thread

How to detect if your exe is allready running through a VB script (WSH)

 
 
Tobias Eriksson
Guest
Posts: n/a
 
      12th Nov 2003
Hi
I just came across a script that I just had to share, there may be
other ways of doing this, but this is at least one way. I've copied
this script almost right as it is from the following web site:
http://www.rgagnon.com/wshdetails/wsh-0020.html
so he(they) should have all the credits.


To determine if your application is running when you are about to
install an upgrade for example you can use the script below. Well,
this is just a stub, you need to make changes in order to fit your
needs, like setting an MSI variable or poping up a dialog like I did
below.

***************************
Set WshShell = WScript.CreateObject("WScript.Shell")

Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
Set props = service.ExecQuery("select name, description from
Win32_Process where name = 'program.exe'")
num = props.Count

If num > 0 Then
'Program is running
MsgBox "AFP is running!"
Else
'Program is not running
MsGBox "AFP is NOT running!"
End If

Set WSHShell = Nothing
**************************

Regards
Tobias
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
script to detect changes in a folder Matt Williamson Microsoft Windows 2000 CMD Promt 3 29th Dec 2006 12:07 AM
How to detect if an app is allready running? feudalac! Microsoft Dot NET Framework 7 8th Sep 2006 07:29 AM
Running a login script only when the script has changed =?Utf-8?B?TXIgQnJvd25zdG9uZQ==?= Microsoft Windows 2000 CMD Promt 4 19th May 2004 01:26 PM
Help Iss stoped running > restart says address is allready in use? Norman Fritag Microsoft ASP .NET 3 19th Mar 2004 02:40 PM
Logon script running a Kixtart script doesn't map drives when logging on from XP AcKBaR[KAC] Microsoft Windows 2000 Networking 0 25th Feb 2004 05:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 AM.