Description

Loads and runs a program.

Syntax

object.Shell(command, window-style, redirection)

Parameters

command
Command can be any 16-bit or 32-bit application. To run command interpreter commands, specify the correct command interpreter as part of the command.
window-style (optional)
One of the following values:
Value Setting Description
0 Hidden Window is hidden and focus is passed to the hidden window.
1 Normal (focused) Window has focus and is restored to its original size and position.
2 Minimized (focused) Window is displayed as an icon with focus.
3 Maximized Window is maximized with focus.
4 Normal Window is restored to its most recent size and position. The currently active window remains active. This is the default.
6 Minimized Window is displayed as an icon. The currently active window remains active.
redirection (optional)
One of the following values:
Value Setting Description
0 None No redirection. This is the default.
1 Stdout Redirect standard output.
2 Stderr Redirect standard error.
3 Both Redirect both standard output and standard error.

Return Value

If redirection is specified, returns the redirected output as a string; otherwise, returns the integer exit code of the command.

Remarks

Script execution is stopped until the program exits.

Example

$Listing = $System.Shell("cmd /c dir c:\myfolder", 0, 3) For Each $Line In Split($Listing, @CRLF) ?"Line=" $Line Next

See Also

Applies To: System


The CHM file was converted to HTML by chm2web software.