9.2 Running Applications from Scripts

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.



Windows XP Annoyances
Fixing Windows XP Annoyances
ISBN: 0596100531
EAN: 2147483647
Year: 2005
Pages: 78
Authors: David A. Karp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net