When you need your script to launch another application, use WshShell’s Run method:
Run strCommand, [intWindowStyle], [bWaitOnReturn]
| The name of the file that starts the application. Unless the file is in the Windows folder, you should include the drive and path to make sure that the script can find the file. | |
| A constant or number that specifies how the application window will appear. These are some of the more useful values: | |
| Window Appearance | |
0 | Hidden | |
1 | Normal size with focus | |
2 | Minimized with focus (this is the default) | |
3 | Maximized with focus | |
Normal without focus | ||
6 | Minimized without focus | |
| A Boolean value that determines whether the application is run asynchronously. If this value is True, the script halts execution until the user exits the launched application; if this value is False, the script continues running once it has launched the application. |
Here’s an example:
Set objWshShell = WScript.CreateObject("WScript.Shell") objWshShell.Run "CONTROL.EXE INETCPL.CPL", 1, True
This Run method launches Control Panel’s Internet Properties dialog box in a normal-sized window, gives control to the dialog box, and waits for the user to close the dialog box before control returns to the script, which immediately exits.
To learn more about launching individual Control Panel icons using Control.exe, please see Chapter 1.
3.145.101.81