Users sometimes become impatient when they're trying to launch an application. While the application is loading, a user might double-click the icon again and launch a second instance of the application. When you're running Windows 2000 Server Terminal Services—as in my organization—launching multiple instances of applications negatively affects performance.

To prevent users from launching a second instance of an application, I wrote the script that Listing 4 shows. ChkProcess.vbs checks to determine whether a user is already running an application. If so, the script generates a message box that tells the user he or she can run only one instance of the application at a time. The script uses the command-line arguments Program and Target. The script's syntax is wscript chkprocess.vbs app.exe c:\appfolder\app.exe.