Consultor Eletrônico



Kbase P153158: 4GL/ABL: Error executing OS-COMMAND with the SILENT NO-CONSOLE options.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/09/2009
Status: Unverified

SYMPTOM(s):

4GL/ABL: Error executing OS-COMMAND with the SILENT NO-CONSOLE options.

'NO-CONSOLE' is not recognized as an internal or external command, operable program or batch file.

Executing the following code snippet:

DEFINE VARIABLE cCommand AS CHARACTER NO-UNDO.
cCommand = "DIR *.* > temp.txt 2>&1".
OS-COMMAND SILENT NO-CONSOLE VALUE(cCommand ).

FACT(s) (Environment):

Windows
OpenEdge 10.x

CAUSE:

The OS-COMMAND is designed to work with one and only one option from the following option set [ SILENT | NO-WAIT | NO-CONSOLE ]. The error is generated because the statement is using the two options SILENT NO-CONSOLE and is viewing the second option NO-CONSOLE as part of the command to be executed.

FIX:

Since the correct syntax of the 4GL/ABL OS-COMMAND statement is:
OS-COMMAND [ SILENT | NO-WAIT | NO-CONSOLE ] [ command-token | VALUE ( expression ) ] ...
The solution is to include one and only one option from the following option set [ SILENT | NO-WAIT | NO-CONSOLE ]. For example:
DEFINE VARIABLE cCommand AS CHARACTER NO-UNDO.
cCommand = "DIR *.* > temp.txt 2>&1".
OS-COMMAND SILENT VALUE(cCommand).