How to? Filenames with "&" character

Aug 15, 2009
I have a file named first & second.txt in D:\SomeFolder.
When I use a batch file containing the string echo %@sfn[%1] (the command line looks like batch.bat "first & second.txt") I get the following:

TCC: D:\SomeFolder\ReFlac.bat [3] Unknown command "~1.TXT"

How can I get the correct short filename, i.e. FIRST&~1.TXT?
Always quote a filename which may contain special characters -- like the ampersand. Even if the filename is coming from a function like @SFN.
echo "%@sfn[%1]"
Thank you guys, it's my inattentiveness – I have a batch file with two %@sfn[%1] functions, I quoted the first one only, but forgot to quote the second, so the result was wrong.

Similar threads