> but I have used this for years
Well, but C:\INVOICES doesn't have any space in it. If you execute such code with a value containing spaces for the first time, then it doesn't work and you simply were lucky all the previous years.
It's as simple as this: Macro substitution substitutes (replaces) the variable name with its value and then executes that:
If you do MyFolder="C:\Program Files\INVOICES", then the value of the MyFolder variable is C:\Program Files\INVOICES, not "C:\Program Files\INVOICES", the double quote characters are delimiting the string, that's why they are called string delimiters, they mark begin and end, the string value begins after the first double quote and ends before the second.
So SET DEFAULT TO &MyFolder after the substitution means SET DEFAULT TO C:\Program Files\INVOICES, not SET DEFAULT TO "C:\Program Files\INVOICES". If you execute ? MyFolder you aso only get C:\Program Files\INVOICES printed on the screen, without the double quotes. And the compilation of te command SET DEFAULT TO C:\Program Files\INVOICES is failing, because all clauses, options and values specified within in a command are space separated. The first space in a file name is ending the file name and making the compiler see the part after the space as another clause, option or value of the command, in this case no further such part is expected, so it's triggering an error and reported as an unknown and invalid clause.
It's obviously no solution to SET DEFAULT TO MyFolder, as that would interpret MyFolder literally as a folder name and most probably not find it, so the way to specify you want a variable value as the parameter value of a command is surrounding it with brackets making it a name expression: SET DEFAULT TO (MyFolder).
The same applies to many commands like SELECT, USE, any IN clause, any part of a command being kind of a parameter value. It's the same thing in DOS, the core reason is spacesd are separators.
Even if you don't know name expressions are done with brackets, you should see what macro substitution does and how it can't work with file names including spaces. The simplest other thing you could do is surround the macrosubstitution with string separators: SET DEFAULT TO "&MyFolder", simply because putting in the value of MyFolder now puts it inside string delimiter double quotes and that also works. The same goes for what Slobodan suggests, he simply used other string delimiters [ and ] to put the normal double quote delimiters inside of the string as part of the string value. Then the macro substitution also contains the double quote characters, which finally act as delimiters. But name expressions are not only one charater shorter, they don't need an additonal compilaton after the substitution. Even if you ever consider using the double string delimiting, don't do it when populating the variable value, let it surround the macro substitution, that makes it easier to understand what's going on.
One thing is sure: You can't insist on this to work, just because it worked for so long. It never was correct, it always depended on the location being in a folder without spaces in its name.
Bye, Olaf.