When I press Ctrl+Enter on a file or directory name with a space in it, the name is properly double quoted on the command line, but if the name contains some other characters, like a comma, then the name is not quoted.
The problem is that batch files consider a comma (and equals and perhaps other characters) to signify the start of a new parameter.
So, given the batch file "comma_test.bat":
-------------
@echo off
echo * = %*
echo 1 = %1
echo 2 = %2
pause
-------------
Executing it on a directory named "A,B" placed on the command line with Ctrl+Enter results in:
comma_test.bat A,B
-------------
* = A,B
1 = A
2 = B
Press any key to continue . . .
-------------
comma_test.bat A=B
-------------
* = A=B
1 = A
2 = B
Press any key to continue . . .
-------------
Can this please be fixed so that Total Commander double quotes any filenames or directories with such characters?
Thank you!
Quote inserted filenames with commas, equals, etc.
Moderators: white, Hacker, petermad, Stefan2
Good idea, MVV. Thanks for chiming in. Based upon my test below, it looks like equals, semi-colon, and comma (=;,) are all considered parameter dividers and they are eliminated in cmd parsing:
comma_test.bat X`~!@#$%^*()-+_={}[];:',./\?X
* = X`~!@#$%*()-+_={}[];:',./\?X
0 = comma_test.bat
1 = X`~!@#$%*()-+_
2 = {}[]
3 = :'
4 = ./\?X
5 =
The standard I/O flow characters should also be double quoted if they are in a filename (e.g. ampersands are fairly common): <>&|
So, the default for the INI setting should probably be:
=;,<>&|
(plus space, of course)
I'm not sure about unicode. fwiw, I haven't found harm in excessive quoting, just in deficient quoting. imho, this almost qualifies as a bug, but it has lasted so long in tcmd.
comma_test.bat X`~!@#$%^*()-+_={}[];:',./\?X
* = X`~!@#$%*()-+_={}[];:',./\?X
0 = comma_test.bat
1 = X`~!@#$%*()-+_
2 = {}[]
3 = :'
4 = ./\?X
5 =
The standard I/O flow characters should also be double quoted if they are in a filename (e.g. ampersands are fairly common): <>&|
So, the default for the INI setting should probably be:
=;,<>&|
(plus space, of course)
I'm not sure about unicode. fwiw, I haven't found harm in excessive quoting, just in deficient quoting. imho, this almost qualifies as a bug, but it has lasted so long in tcmd.