Pass multiple file paths to exe using internal association

English support forum

Moderators: Hacker, petermad, Stefan2, white

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

Pass multiple file paths to exe using internal association

Post by *msrox »

I'd like to pass multiple file paths to an exe using internal association. This is what I have in wincmd.ini:

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

however this produces something like this:

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

and I need it to be like bellow with each path double quoted:

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

is there anyway to do this? am I doing something wrong?
User avatar
Vochomurka
Power Member
Power Member
Posts: 816
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Post by *Vochomurka »

Try lst2str and/or lst2multi utilities
Single user license #329241
PowerPro scripts for Total Commander
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox »

Vochomurka wrote:Try lst2str and/or lst2multi utilities
so no way to do this with TC itself and without any third party exe?
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

 


I don't know much about internal association and so I wonder why you have "%2" there. I always have only "%1"
Association opens a specific file type with an specific application and use %1 to pass the file name as parameter.
Don't know if you can pass two files as parameter as your first post implicies?
How do you use this? What is your work flow? How do you select two files and call this internal association?



If this would work, which I don't know, I would modify the ini and change
Filter1_abc=%COMMANDER_DRIVE%\EXE.exe FirstSwitch "%2"
to
Filter1_abc="%COMMANDER_DRIVE%\EXE.exe FirstSwitch "%1" "%2""
for an test.



 
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

2Stefan2
The difference between %1 and %2 is that
- %1 calls the program multiple times with a single file parameter
- %2 just calls the program once with a list of all marked files.

2msrox
Try %2 without quotes.
If on of the paths contains spaces TC will add quotes automatically.
This should work with most programs.

2ghisler(Author)
Quoting seems to have a bug.
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 Parameter3:%2
@Echo Parameter3:%3
listing all parameters will produce:
Parameter1:""1Path
Parameter3:A" 2PathB "3Path
Parameter3:C"
Internal association wrote:%COMSPEC% /k d:\param.bat "%2"
Regards
Holger
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Ahh, danke. Wieder 'was gelernt.
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox »

HolgerK wrote:2Stefan2
The difference between %1 and %2 is that
- %1 calls the program multiple times with a single file parameter
- %2 just calls the program once with a list of all marked files.

2msrox
Try %2 without quotes.
If on of the paths contains spaces TC will add quotes automatically.
This should work with most programs.

2ghisler(Author)
Quoting seems to have a bug.
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 Parameter3:%2
@Echo Parameter3:%3
listing all parameters will produce:
Parameter1:""1Path
Parameter3:A" 2PathB "3Path
Parameter3:C"
Internal association wrote:%COMSPEC% /k d:\param.bat "%2"
Regards
Holger
Thanks for your reply. It doesn't work either. It works for more than one file path, but if it is just one file path with space in it, it doesn't add double quotation! Any other way to fix this?
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

msrox wrote:..., but if it is just one file path with space in it, it doesn't add double quotation!
Confirmed!
msrox wrote:Any other way to fix this?
Only idea to fix this temporarily is to add a second command with "%1" and select this for single files from the context menu.

Regards
Holger
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox »

HolgerK wrote:
msrox wrote:..., but if it is just one file path with space in it, it doesn't add double quotation!
Confirmed!
msrox wrote:Any other way to fix this?
Only idea to fix this temporarily is to add a second command with "%1" and select this for single files from the context menu.

Regards
Holger
thanks Holger for your replies. I think I better stick with sendmessage and copying all the file paths as a multi-line string to clipboard. It is just really strange to me that ghisler(Author) hasn't fixed such a bug! Can we notify them of this so that they can fix it?
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

Don't worry.
I guess he already read this thread, and if not: there is the bug report forum.

Instead of using sendmessage and clipboard you can also try a button or user command like
TOTALCMD#BAR#DATA
%COMSPEC% /K D:\Param.bat
%P%S
C:\Windows\System32\imageres.dll,11



-1
Just replace "%COMSPEC% /K D:\Param.bat" with the path to your exe and add your parameter in front of %P%S

Regards
Holger
msrox
Member
Member
Posts: 101
Joined: 2008-03-14, 00:10 UTC

Post by *msrox »

HolgerK wrote:Don't worry.
I guess he already read this thread, and if not: there is the bug report forum.

Instead of using sendmessage and clipboard you can also try a button or user command like
TOTALCMD#BAR#DATA
%COMSPEC% /K D:\Param.bat
%P%S
C:\Windows\System32\imageres.dll,11



-1
Just replace "%COMSPEC% /K D:\Param.bat" with the path to your exe and add your parameter in front of %P%S

Regards
Holger
Hi Holger,

Great, thank you.
Post Reply