|
<< Click to Display Table of Contents >> Navigation: Miscellaneous functions and statements > Shell |
Description
Runs an executable program and returns an Integer representing the program's task ID if successful, otherwise it returns zero.
Syntax
Shell(pathname[,windowstyle])
Parameters
Part |
Type |
Description |
pathname |
String |
Required; Name of the program to execute and any required arguments or command-line switches; may include directory or folder and drive. |
windowstyle |
Integer |
Optional. Integer corresponding to the style of the window in which the program is to be run. If windowstyle is omitted, the program is started minimized with focus. |
The windowstyle named argument has these values:
Constant |
Value |
Description |
vbHide |
0 |
Window is hidden and focus is passed to the hidden window. |
vbNormalFocus |
1 |
Window has focus and is restored to its original size and position. |
vbMinimizedFocus |
2 |
Window is displayed as an icon with focus. |
vbMaximizedFocus |
3 |
Window is maximized with focus. |
vbNormalNoFocus |
4 |
Window is restored to its most recent size and position. The currently active window remains active. |
vbMinimizedNoFocus |
6 |
Window is displayed as an icon. The currently active window remains active. |
Remarks
Each pair of adjacent double quotation marks (" ") within the string literal is interpreted as one double quotation character in the string.
Result = Shell("""C:\Program Files\display.exe"" -a -q", vbNormalFocus)
Therefore, the preceding example presents the following string to the Shell function:
"C:\Program Files\display.exe" -a –q
If the path is not enclosed in quotation marks, Windows looks for a file called Program.exe in the C:\ directory, instead of display.exe in the C:\Program Files directory.