Pass multiple file paths to exe using internal association
Moderators: Hacker, petermad, Stefan2, white
Pass multiple file paths to exe using internal association
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?
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?
- Vochomurka
- Power Member
- Posts: 816
- Joined: 2005-09-14, 22:19 UTC
- Location: Russia
- Contact:
Single user license #329241
PowerPro scripts for Total Commander
PowerPro scripts for Total Commander
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.
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:
a batch
Holger
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"
listing all parameters will produce:param.bat wrote:@Echo Parameter1:%1
@Echo Parameter3:%2
@Echo Parameter3:%3
Parameter1:""1Path
Parameter3:A" 2PathB "3Path
Parameter3:C"
RegardsInternal association wrote:%COMSPEC% /k d:\param.bat "%2"
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?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:a batchCode: Select all
""1Path A" 2PathB "3Path C"
listing all parameters will produce:param.bat wrote:@Echo Parameter1:%1
@Echo Parameter3:%2
@Echo Parameter3:%3Parameter1:""1Path
Parameter3:A" 2PathB "3Path
Parameter3:C"RegardsInternal association wrote:%COMSPEC% /k d:\param.bat "%2"
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?HolgerK wrote:Confirmed!msrox wrote:..., but if it is just one file path with space in it, it doesn't add double quotation!Only idea to fix this temporarily is to add a second command with "%1" and select this for single files from the context menu.msrox wrote:Any other way to fix this?
Regards
Holger
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
Regards
Holger
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
Just replace "%COMSPEC% /K D:\Param.bat" with the path to your exe and add your parameter in front of %P%STOTALCMD#BAR#DATA
%COMSPEC% /K D:\Param.bat
%P%S
C:\Windows\System32\imageres.dll,11
-1
Regards
Holger
Hi Holger,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 likeJust replace "%COMSPEC% /K D:\Param.bat" with the path to your exe and add your parameter in front of %P%STOTALCMD#BAR#DATA
%COMSPEC% /K D:\Param.bat
%P%S
C:\Windows\System32\imageres.dll,11
-1
Regards
Holger
Great, thank you.