Internal Associations: issue with "%2"

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Internal Associations: issue with "%2"

Post by *msrox »

"%2" does not work in file association. It does not add double-quotation to file paths and this cause problems if there is a space in file path.

This is what I have in wincmd.ini:

Filter1_abc=%COMMANDER_DRIVE%\EXEname.exe FirstSwitch "%2"

and it produces something like this:

%COMMANDER_DRIVE%\EXE.exe FirstSwitch c:\file 1.txt c:\file 2.txt

and It is supposed to be like this:

%COMMANDER_DRIVE%\EXE.exe FirstSwitch "c:\file 1.txt" "c:\file 2.txt"
User avatar
HolgerK
Power Member
Power Member
Posts: 5406
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

Confirmed:

Given three marked files "1Path A" "2PathB" "3Path C" the parameter list is expanded as:

Code: Select all

""1Path A" 2PathB "3Path C"
a batch
param.bat wrote:@Echo Parameter1:%1
@Echo Parameter2:%2
@Echo Parameter3:%3
listing all parameters will produce:
Parameter1:""1Path
Parameter2:A" 2PathB "3Path
Parameter3:C"
Internal association wrote:%COMSPEC% /k d:\param.bat "%2"
Regards
Holger
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox »

still no fix for this bug?
how about any solution to fix this when using internal association?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

%2 has never been supported by TC, only %1.
Author of Total Commander
https://www.ghisler.com
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox »

What do you mean? This is from Total Commander help in page Dialog box: Edit file type (internal associations):

Program used for the 'open' action. This is always the default verb (used when pressing ENTER) for internal associations. You need to put %1 or "%1" (or %2) behind the program name so the file is passed as a parameter. The difference between %1 and %2 only appears when right clicking on multiple files. Choosing an internal command with %1 will open all selected files in separate editors, while %2 will pass them all to the same program. This will of course only work when that editor can accept multiple files as parameters.

Am I missing something here?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I thought that you were talking about file associations, as mentioned in the first post, not internal associations.

I found the following regarding %2 in history.txt:

03.03.09 Added: Internal associations: Parameter %2 instead of %1 passes all selected file names at once to the editor (not separate editors) - the editor has to support multiple parameters
Author of Total Commander
https://www.ghisler.com
Post Reply