OS-COMMAND Won't Run With a Variable Path

HT3

Member
Hi,

I've got an application which runs a .bat file using the OS-COMMAND statement, it's called a number of times within in the application.

The path was hardcoded previously, however due the number of times it's called and now that I want it to run a different .bat file depending on the value of another parameter. I thought it's best to add variable to the start of the path reducing the amount of times I need change the path going forward etc.

Example of current line of code which works, I've just replaced the .bat file with one of my own which goes to a website.

Code:
OS-COMMAND SILENT "C:\Temp\HT\Website.bat".

My attempted amendment that doesn't work.

Code:
DEFINE VARIABLE cDir4Control AS CHARACTER NO-UNDO INITIAL "C:\Temp\".

OS-COMMAND SILENT cDir4Control + "HT\Website.bat".

Any suggestions please.

Thanks,
Hassam
 

HT3

Member
Thank you @Osborne , just so I've got this right anytime I have variable and want to achieve anything with it using another statement I have to use VALUE?

I've previously done this but only when outputting to a stream.
 

TomBascom

Curmudgeon
Thank you @Osborne , just so I've got this right anytime I have variable and want to achieve anything with it using another statement I have to use VALUE?

I've previously done this but only when outputting to a stream.

No.

VALUE() is a keyword associated with statements that allow filenames and paths to be hard coded. VALUE() is basically saying “it’s not hard coded this time”.

File names and paths need to be handled specially in this manner because the default syntax allows you to hard code them directly into the statement. You don’t even need quotes.

Other uses of variables in other statements do not need VALUE()
 

HT3

Member
Thank you so much @TomBascom, I've always put quotes against paths...... I've just tried it without quotes and it worked.

Thank you for clarifying the VALUE functionality.
 
Top