OS-COMMAND statement
Escapes to the current operating system and executes an operating system command.
Syntax
SILENT
After processing an operating system command, the AVM shell pauses. To exit the window in Windows GUI platforms, you must type exit. To exit the window in Windows character platforms, you must type exit and press RETURN or SPACEBAR. You can use the SILENT option to eliminate this pause. Use this option only if you are sure that the program, command, or batch file does not generate any output to the screen. Cannot be used with NO-WAIT.NO-WAITNO-CONSOLEcommand-token
| VALUE (expression
)
One or more command words and symbols that you want to pass the operating system to execute. The VALUE option generates the command tokens included inexpression
, a character string expression. The specified combination ofcommand-token
and VALUE(expression
) options can form any legal combination of commands and command options permitted by the operating system.ExampleThere are two principal uses for the OS-COMMAND statement: to execute a utility that has the same syntax on two or more different operating systems, and to execute an operating system statement input by a user.
In both instances, the OS-COMMAND statement eliminates the need to use the OPSYS statement to determine the operating system and then use conditional logic to execute the appropriate code. The OS-COMMAND statement, therefore, makes an application more portable.
This procedure prompts the user for an operating system command and then uses the OS-COMMAND statement to execute the command:
Notes
- If you want to run an operating system internal command, such as Windows
dir
, do not use the NO-WAIT keyword. The results are unpredictable.- If you want to run an application that requires Windows, you must use the NO-WAIT option.
- The NO-WAIT option is unavailable in environments that are not multi-tasking.
- The OS-COMMAND statement always sets the value for the OS-ERROR function to 0, whether or not an error occurs. Thus, an operating system error is never returned for the OS-COMMAND statement.
See alsoDOS statement, OPSYS function, OS-ERROR function, UNIX statement
OpenEdge Release 10.2B
|