PreviousNextIndex

OS-COMMAND statement

Escapes to the current operating system and executes an operating system command.

Syntax

OS-COMMAND 
  [ SILENT | NO-WAIT | NO-CONSOLE ]  
  [ command-token | VALUE ( expression ) ] ... 

SILENT
NO-WAIT
NO-CONSOLE
command-token | VALUE ( expression )
Example

There 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:

r-os-com.p
DEFINE VARIABLE comm-line AS CHARACTER NO-UNDO FORMAT "x(70)". 
REPEAT: 
  UPDATE comm-line. 
  OS-COMMAND VALUE(comm-line). 
END. 

Notes
See also

DOS statement, OPSYS function, OS-ERROR function, UNIX statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex