Bug - short filenames with & under NT
Moderators: Hacker, petermad, Stefan2, white
Bug - short filenames with & under NT
(Edited)
The quoting behaviour of Control Shift Enter, when entering filenames on the command line, doesn't always cater for special characters under NT (tested in TC 6.02 with &).
When using Control Shift Enter to pass a drv:\path\filename.ext to a command line - and the path\filename doesn't contain any long filename elements - then TC doesn't quote the drv:\path\filename.ext
If using NT and the short filename contains an ampersand (&) then the command line doesn't behave as expected, because it is not quoted.
Some might say filenames shouldn't contain ampersands, but MS allows them to, as well as the pesky % and ^
Given this situation I'd like to suggest that TC always quote the path and filenames for command line use, even short names.
The quoting behaviour of Control Shift Enter, when entering filenames on the command line, doesn't always cater for special characters under NT (tested in TC 6.02 with &).
When using Control Shift Enter to pass a drv:\path\filename.ext to a command line - and the path\filename doesn't contain any long filename elements - then TC doesn't quote the drv:\path\filename.ext
If using NT and the short filename contains an ampersand (&) then the command line doesn't behave as expected, because it is not quoted.
Some might say filenames shouldn't contain ampersands, but MS allows them to, as well as the pesky % and ^
Given this situation I'd like to suggest that TC always quote the path and filenames for command line use, even short names.
- ghisler(Author)
- Site Admin
- Posts: 50508
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Hmm, why should file names with ampersand be quoted? The following command line works for me:
notepad a&b.txt
To my knowledge, quotes are only necessary when file names contain spaces, so the target application doesn't break the name into multiple parameters.
notepad a&b.txt
To my knowledge, quotes are only necessary when file names contain spaces, so the target application doesn't break the name into multiple parameters.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
When you drag&drop the filename rom file pan to command line while holding Control+Shift then you get the short name instead (e.g. "c:\!#$%^&~1.TXT" instead of "c:\!#$%^&()+_[]{},';`~.txt" which you get by pressing Ctrl+Shift+Enter).
Does anybody know a shortcut for making such short file name without mouse?
Does anybody know a shortcut for making such short file name without mouse?

edited
Ghisler said
& is a command separator for command line/batch file use.
cmd /? lists other characters which need to be quoted at various times.
Run this command line using the batch at the end, to see the effect.
batch.bat a,b;c=d
@echo off
echo %1 %2 %3 %4
Ghisler said
try dir a&b.txt under NT.Hmm, why should file names with ampersand be quoted? The following command line works for me:
notepad a&b.txt
& is a command separator for command line/batch file use.
They also are necessary for semicolons, commas and equals.To my knowledge, quotes are only necessary when file names contain spaces, so the target application doesn't break the name into multiple parameters.
cmd /? lists other characters which need to be quoted at various times.
Run this command line using the batch at the end, to see the effect.
batch.bat a,b;c=d
@echo off
echo %1 %2 %3 %4
- ghisler(Author)
- Site Admin
- Posts: 50508
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
For batch files, create a button which contains the necessary double quotes in the parameters line. For normal programs, no "" are needed even with & in the name...
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
dropping filenames to Total app's bar
Sorry for my bad English.
problem:
on localized (russian) win2k (sp4) dragging file from Total's pane and drop to Total's app's bar gives to target app a commandline with short (Dos-like) filepath, but national (russian) chars in this commandline string looks like C:\Book\EBE5~.TXT
therefore, commandline is valid and dropped file opens normally.
But dragging and drop to the same app on MS QuickLunch works more good - filepath is long, commandline looks as normal string - with russian symbols, file opened normal.
Is it bug or feature?
problem:
on localized (russian) win2k (sp4) dragging file from Total's pane and drop to Total's app's bar gives to target app a commandline with short (Dos-like) filepath, but national (russian) chars in this commandline string looks like C:\Book\EBE5~.TXT
therefore, commandline is valid and dropped file opens normally.
But dragging and drop to the same app on MS QuickLunch works more good - filepath is long, commandline looks as normal string - with russian symbols, file opened normal.
Is it bug or feature?
- ghisler(Author)
- Site Admin
- Posts: 50508
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
This is a feature. Use Ctrl+Enter or Ctrl+Shift+Enter to get the long name.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
short filepath
hmmm....
i like mouse operations ...
What for this feature?
i like mouse operations ...
What for this feature?
Commands---
2vito333
Hello !
• Like you, I much prefer to use the mouse...
There are two commands about the name-style display :
cm_SwitchLongNames=2010
cm_Switch83Names=2013
with which you can set buttons in the bar. They are in the "Display" section of <totalcmd.inc>
Kind regards,
Claude
Clo

• Like you, I much prefer to use the mouse...
There are two commands about the name-style display :
cm_SwitchLongNames=2010
cm_Switch83Names=2013
with which you can set buttons in the bar. They are in the "Display" section of <totalcmd.inc>

Claude
Clo
#31505 Traducteur Français de T•C French translator Aide en Français Tutoriels Français English Tutorials
Ghisler said:
I guess that quoting short file/path names just because it contains an & (or , ; -) would break some compatibility with older MSdos executables. OTOH having it break compatibility with .bat and .cmd files seems to me to be a worse crime as more users will be using .BAT and .CMD files than will be using MSdos executables.
I seem to have lost your interest. I asked about the button you suggested as TC won't insert a filename between two quotes.For batch files, create a button which contains the necessary double quotes in the parameters line.
I guess that quoting short file/path names just because it contains an & (or , ; -) would break some compatibility with older MSdos executables. OTOH having it break compatibility with .bat and .cmd files seems to me to be a worse crime as more users will be using .BAT and .CMD files than will be using MSdos executables.