OS-COMMAND

Posted by ericg on 19-Jan-2009 19:15

Hello. I want to run a Windows command line script that has quotes in it. But when my procedure trys to run the OS-COMMAND, it bombs. I have something like this:

OS-COMMAND SILENT VALUE("cscript " + cscript-file + " " + quote + FILENAME + quote + " " + quote + "sometext" + quote + " " + quote + quote).

So the quote variable contains the " quote symbol.

Any suggestions?

So it would look like this on the command line for example:

cscript "

I did try the script by myself on the command line and it works. Also I debugged csript-file and filename variables and they do have intended values.

All Replies

Posted by Matt Baker on 19-Jan-2009 21:03

A few suggestions:

1) Take the SILENT off so you can get your error messages, then when you get it working, add it back.

2) You can also try INPUT THROUGH statement to read any error messages that might be returned.

3) Make sure cscript is in your PATH for the operating system. The environment OpenEdge uses is generally picked up from whatever script launches it, but if you have a custom script, it might not be there. Note that PROPATH is NOT used when running operating system commands; PATH from the operating system is. You can just trying calling it without any parameters and see if it runs properly.

Posted by ericg on 20-Jan-2009 13:56

Thanks for the suggestions Matthew. But I managed to remove the last two parameters since they were constant anyways and I found that I did not need to enclose the first parameter in quotes. Then it worked. So I think the problem was using quotes in the OS-COMMAND. Take care

Posted by ChUIMonster on 22-Jan-2009 13:02

In cases like this it is helpful to remember that Progress 4gl supports two styles of quoting. Both ' and " can serve as the delimiter for quoted strings. If you are using " in the external command that you are building then you can use ' in your 4gl code in order to keep it clear which one is being used at which layer.

Posted by Peter Judge on 22-Jan-2009 13:04

In cases like this it is helpful to remember that

Progress 4gl supports two styles of quoting. Both '

and " can serve as the delimiter for quoted strings.

If you are using " in the external command that you

are building then you can use ' in your 4gl code in

order to keep it clear which one is being used at

which layer.

You can (dare I say should) also use the QUOTER() statement in the ABL when building stuff like this or dynamic query where clauses.

-- peter

Posted by ericg on 23-Jan-2009 10:57

Yes the QUOTER function. Thanks Peter.

This thread is closed