Bug - short filenames with & under NT

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
foxidrive
Junior Member
Junior Member
Posts: 90
Joined: 2004-02-28, 11:50 UTC

Bug - short filenames with & under NT

Post by *foxidrive »

(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.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50506
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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.
Author of Total Commander
https://www.ghisler.com
IGL
Member
Member
Posts: 179
Joined: 2004-02-26, 10:47 UTC
Location: Poland

Post by *IGL »

It seems to work fine without quotes, even for names with strange characters, like:
!#$%^&()+_[]{},';`~
and works fine with names containing Polish characters too.
I see no problem in TC.

Anybody knows when quotes are necessary for filenames?
AFAIK, quotes are necessary for filenames with spaces.
:-)
IGL
Member
Member
Posts: 179
Joined: 2004-02-26, 10:47 UTC
Location: Poland

Post by *IGL »

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?
:-)
foxidrive
Junior Member
Junior Member
Posts: 90
Joined: 2004-02-28, 11:50 UTC

Post by *foxidrive »

edited

Ghisler said
Hmm, why should file names with ampersand be quoted? The following command line works for me:

notepad a&b.txt
try dir a&b.txt under NT.

& is a command separator for command line/batch file use.
To my knowledge, quotes are only necessary when file names contain spaces, so the target application doesn't break the name into multiple parameters.
They also are necessary for semicolons, commas and equals.
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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50506
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
foxidrive
Junior Member
Junior Member
Posts: 90
Joined: 2004-02-28, 11:50 UTC

Post by *foxidrive »

I'm not sure I understand.
Are you suggesting that I insert two quotes into the command line from a button, and then control-enter the filename in between the two quotes?
vito333
Junior Member
Junior Member
Posts: 2
Joined: 2004-04-15, 07:23 UTC

dropping filenames to Total app's bar

Post by *vito333 »

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?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50506
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This is a feature. Use Ctrl+Enter or Ctrl+Shift+Enter to get the long name.
Author of Total Commander
https://www.ghisler.com
vito333
Junior Member
Junior Member
Posts: 2
Joined: 2004-04-15, 07:23 UTC

short filepath

Post by *vito333 »

hmmm....

i like mouse operations ...

What for this feature?
IGL
Member
Member
Posts: 179
Joined: 2004-02-26, 10:47 UTC
Location: Poland

Post by *IGL »

Normally you get short file name instead of long file name. It may be useful sometimes (when there are problems with long file name)

Many TC users love keyboard! It allows to work faster - try it.
:-)
foxidrive
Junior Member
Junior Member
Posts: 90
Joined: 2004-02-28, 11:50 UTC

Post by *foxidrive »

Ghisler said:
For batch files, create a button which contains the necessary double quotes in the parameters line.
Sorry Christian, I don't understand your suggestion to fix my problem.
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Commands---

Post by *Clo »

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>

:mrgreen:   Kind regards,
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
foxidrive
Junior Member
Junior Member
Posts: 90
Joined: 2004-02-28, 11:50 UTC

Post by *foxidrive »

Ghisler said:
For batch files, create a button which contains the necessary double quotes in the parameters line.
I seem to have lost your interest. I asked about the button you suggested as TC won't insert a filename between two quotes.

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.
IGL
Member
Member
Posts: 179
Joined: 2004-02-26, 10:47 UTC
Location: Poland

Post by *IGL »

I disagree, I rather have it this way or modify that .BAT file (but taht's not always possible to fix) :)
Maybe we need another option?
:-)
Post Reply