Fixing Windows XP Annoyances

This code is used to run a program, which can be a DOS program, a Windows application, an Internet or mailto URL, or anything else you might normally type in the Start Menu's Run command or Explorer's Address Bar. Place this subroutine in your scripts:

Sub RunProgram(Filename, Wait) Set WshShell = WScript.CreateObject("WScript.Shell") RetVal = WshShell.Run(Filename, Wait) End Sub

and call the routine like this:

Call RunProgram("c:\windows\notepad.exe", True)

You can replace True with False if you don't want to wait for the program to finish before the next script command is executed.

Категории