OS-COMMAND choking on blank in path

Posted by Admin on 09-Dec-2009 13:59

I want to run HelloWorld.bat from the My Documents directory. I'm using OS-COMMAND VALUE("C:\Documents and Settings\My Documents\HelloWorld.bat") and it chokes on the blanks.

It works fine if I put my file directly on C: and use OS-COMMAND VALUE("C:\temp\HelloWorld.bat"), but I don't want to have to put my program in C:\temp.

Also, if I'm at the DOS prompt, I can cd to C:\Documents and Settings\My Documents, hit enter, then type HelloWorld.bat and it works fine.  

All Replies

Posted by Admin on 10-Dec-2009 02:10

Make your string value for the path a quoted one.

Try this:

OS-COMMAND VALUE(' "C:\Documents and Settings\My Documents\HelloWorld.bat" ').

or

define variable pathToBatFile as character no-undo initial "C:\Documents and Settings\My Documents\HelloWorld.bat".

OS-COMMAND VALUE(QUOTER(pathToBatFile)).

Hope it helps.

Posted by Admin on 10-Dec-2009 08:36

You're awesome! This works beautifully!!

This thread is closed