OS-COMMAND
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Use the OS-COMMAND statement to execute an operating system statement that
you cannot execute using the OS statements listed in Standard system commands. The OS-COMMAND statement provides a generic,
operating-system-independent way to escape to the current operating system, which lets
you:
- Execute a OpenEdge or operating system command that has the same syntax on two or more different operating systems.
- Start an operating system shell.
- Execute an operating system statement that a user enters.
The
arguments to OS-COMMAND must be appropriate for
the current operating system. Therefore, where possible, read these
arguments at run time from the user, database table, or environment
variables rather than hard coding them. The following procedure
prompts the user for an operating system command, then uses the OS-COMMAND statement
to execute the command:
|
The OS-COMMAND statement eliminates
the need to use the OPSYS function to determine
the operating system. However, if you cannot use the OS-COMMAND statement, use
the OPSYS function to determine the operating system you
are running on, and use conditional logic to execute the appropriate
code using one of the operating-system-specific escape statements.
The NO-WAIT option
of OS-COMMAND is valid only in multi-tasking environments.
This option causes OpenEdge to pass control to the statement following the OS-COMMAND,
without waiting for the operating system command to terminate. If
you are using the OS-COMMAND statement to run an
independent Windows application, use the NO-WAIT option.
For more information, see the OS-COMMAND
Statement reference entry in ABL Reference.