Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Filenames with "&" character

Aug
14
1
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:

D:\SOMEFO~1\FIRST
~1.TXT
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.
Code:
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.
 
Back
Top
[FOX] Ultimate Translator
Translate