On 11/12/2023 9:17 AM, ED FURCHE wrote: > I HAVE USED THIS BEFORE BUT DONT REMEMBER HOW. > > I WANT TO REFER TO A VARIABLE IN A COMMAND > > EXAMPLE CTR=1 > USE C:\BACKUP\CTR\CHECK.DBF TO ADDRESS USE C:\BACKUP\1\CHECK >
You would do this in a couple ways, the easiest is to build the command
as a string, and insert the variable into it:
cCmd = [USE C:\BACKUP\]+CTR+[CTR\CHECK.DBF TO ADDRESS USE C:\BACKUP\1\CHECK]
Note that by using the square brackets as delimiters you don't have any
confusion with quotes ...
To execute the command (use macro expansion):
&cCmd.
Another way is:
USE C:\BACKUP\&CTR.\CHECK.DBF TO ADDRESS USE C:\BACKUP\1\CHECK
But that gets a bit hard to read, and it's easy to make mistakes. Also
if the value of your variable includes spaces, it can be a problem,
you'd have to deal delimiters ...