RUN

Top  Previous  Next

Syntax:

 

RUN <program_path parameters…> { , WAIT n } { , PIPE } { , <desktop_name> }

 

Description:

 

Runs a program. The program path must be that of an executable (.exe) file, and may be followed by a space and command line parameters. If the path or parameters contain spaces then it may be necessary to put quotes around them. This may be done using @CHR(34) to generate the quote '"' character.

If the WAIT parameter is included then script execution does not continue until the program has terminated. The WAIT parameter can be followed by a number, n. This specifies the maximum number of seconds that the command will wait for the program to terminate, before continuing. This option may be useful when running commands that halt, awaiting input, if they encounter an error condition. Without a time-out being specified, the WAIT command would wait indefinitely in this situation, causing the script to hang.

The PIPE parameter causes standard output from a command line program to be fed back to the script. It can then be assigned to a string list for analysis, using the @PIPE function. Note: Due to differences in the way in which some command line programs write their output, it is not always possible to capture output from a program in this way. In some cases it may be necessary to run the program from within a command shell (COMMAND.COM under Windows 95, CMD.EXE under Windows NT.)

If the parameter is neither WAIT or PIPE it is treated as a <desktop_name> string. This specifies either the name of the desktop only or the name of both the window station and desktop for the program to run on. A backslash in the string indicates that the string includes both desktop and window station names. Otherwise, the string is interpreted as just a desktop name.

This command has four variants:

RUN

run as a normal window

RUNH

run in a hidden window

RUNM

run as a maximized window

RUNZ

run minimized as an icon

These variants set an option within Windows to specify how the program should be run. However, some Windows programs may ignore the option.

Note: If you run an MS-DOS program and want it to close its window when it finishes make sure the program's "close window on exit" property is set.

 

OK:

 

Set to false if the command fails.

 

Example:

 

RUN winword.exe

RUNZ c:\utils\unzip.exe c:\myzip.zip,WAIT

 

See also: