Custom Shortcut > Open Selected Multiple Files / execute multiple files

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
pavol
Junior Member
Junior Member
Posts: 4
Joined: 2024-07-07, 21:39 UTC

Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *pavol »

Please,
I am googling but I cant find any solution please,.... Please I would like to open selected files when I click shortcut in total commander (installed tcmd1103x32_64.exe)..

What it works in totall commander "comand line" is this (an example is two files, but it can be in any dirrectory or any different number/type of files, depend what is selected in total commander)
C:\Windows\System32\cmd.exe /c START "" d:\__3D\1.txt && d:\__3D\2.txt
OR
cmd /c start "" d:\__3D\1.txt && d:\__3D\2.txt

but it is impossible implement it in usercommand.Ini
please can someone share with me some working solution, what should i/we fill in?

Unfortunatelly this example will open only one file, not multiple.
Command: C:\Windows\System32\cmd.exe /c START ""
Parameters: %P%S
Start Path:
Thank you for any message, thanks thanks
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *ghisler(Author) »

You can open multiple selected files by defining an internal association via menu Files - Internal associations.
Leave the default verb "open" empty, and add a new verb with your command.

You can then right click on the selected files for half a second or press the menu key or Shift+F10 to reach the user-defined command.
Author of Total Commander
https://www.ghisler.com
pavol
Junior Member
Junior Member
Posts: 4
Joined: 2024-07-07, 21:39 UTC

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *pavol »

Thank you for your replay,
I am trying to make it works, but it looks like it not reacting on holding right mouse button for 1 sec.....

what i did is,

1) Internal association > Add > (Specify File Type Window)
Specify Type = *.*
Click "OK"

3) (Edit Fily Type)
Type Name = *.*
Click "NEW"

4) (Edit Action)
Action (verb) = C:\Windows\System32\cmd.exe
Command (program) = C:\Windows\System32\cmd.exe /c START ""

5) (Edit Action) Click "OK"

6) (Edit Fily Type) Click "OK"

7) (Internal association) Click "OK"

8) Now I am back in Total commander and trying to right mouse button for 1 sec or more and nothing happenning...

-------------------

Please is there any way to connect it with usercmd.ini that i can set thi under keyboard shortcut?

Thank you for any answer best regards P
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *petermad »

2pavol
Try this button:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC% /C
if exist %S1\ ((echo DO NOT MARK DIRECTORIES!) & (echo.) & pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "" "%%n"
%COMMANDER_EXE%,3
Open all selected files with their associated program
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".

Notice, it will only work with file types that are associated to a program in Windows.

The same as en em_command:

Code: Select all

[em_OpenAllSelected]
cmd=%COMSPEC% /C
param=if exist %S1\ ((echo DO NOT MARK DIRECTORIES!) & (echo.) & pause) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WF`) do start "" "%%n"
button=%COMMANDER_EXE%,3
menu=Open all selected files with their associated program
You can hide (minimize) the DOS window by adding iconic=1 to the em_OpenAllSelected command, but then you cannot see the error message if you erroneously select a folder.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
pavol
Junior Member
Junior Member
Posts: 4
Joined: 2024-07-07, 21:39 UTC

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *pavol »

You are super man, uau it works .... uff respect i can see it wasnt that easy.
Really thank you, I hope this help many other people.... because i think this is really great use it through shortcut (open selected files for example pdf or any selected docs or project, pics or etc... )

You are really great that you have License 524, at that time I was poor kid and used shareware :D, really nice 524
Thank you so much guys

For me works "%COMSPEC%" without /C, but it is really nice to see you can open it separatelly through second shortcut with /C

Thank you so much guys again. Hope other can also enjoy this shortcut stuff. Best regards P.
Last edited by pavol on 2024-07-10, 04:38 UTC, edited 1 time in total.
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *petermad »

2pavol
the chcp 65001 && %%COMSPEC%% /C part is to support Unicode filenames.

If you leave out the /C part in the "Command" field, it will not (always) work with Unicode filenames, and it will open folders in Windows Explorer.

I cannot recommend changing: %COMSPEC% /C to: %COMSPEC%
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
beb
Power Member
Power Member
Posts: 580
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *beb »

2pavol

user commands to execute/open a file/multiple selected files in the associated application(s):

Cross-platform PowerShell (v.7+) based:

- usercmd.ini entry:

Code: Select all

[em_test_tc_open_selected_files_in_associated_app]
cmd=pwsh
param=-command Get-Content "%WL"|ForEach {Invoke-Item "$_"}
- toolbar button:

Code: Select all

TOTALCMD#BAR#DATA
em_test_tc_open_selected_files_in_associated_app

WCMICONS.DLL,28
Windows PowerShell based:

- usercmd.ini entry:

Code: Select all

[em_test_tc_open_selected_files_in_associated_app_ps2]
cmd=Powershell
param=-command Get-Content "%WL"|ForEach {Invoke-Item "$_"}
- toolbar button:

Code: Select all

TOTALCMD#BAR#DATA
em_test_tc_open_selected_files_in_associated_app_ps2

WCMICONS.DLL,28
Note:
Invoke-Item
Invoke the (provider-specific) default action on an item (like a START command or double click.) This will force the default action to be run on the item. For example a .PDF file will open in whatever program is associated with PDF files.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
User avatar
white
Power Member
Power Member
Posts: 5753
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *white »

petermad wrote: 2024-07-09, 01:25 UTC If you leave out the /C part in the "Command" field, it will not (always) work with Unicode filenames, and it will open folders in Windows Explorer.
Wouldn't this be generally sufficient? :

Code: Select all

TOTALCMD#BAR#DATA
"%comspec%" /c
For %%i in (%P%S10) do @Start "" %%i
%comspec%
Open mutiple files (10 at the max)

1
-1
I don't expect, in this case, that parsing by the For command and parameter parsing by the Start command would cause Unicode problems. Or would it for older Windows versions?
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *petermad »

2white
Or would it for older Windows versions?
It works OK for Windows XP :-)

The problem with %P%S is the limit of the length of the command line. But when restricting it to 10 files it should not be a problem.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
jonathanpoulin
Member
Member
Posts: 131
Joined: 2020-12-19, 12:09 UTC
Location: Saint-Marc-des-Carrières, QC Canada
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *jonathanpoulin »

2petermad

For your solution, I was curious and I tried it. For some reason on my Windows 11 computer, the part with the backticks cannot be interpreted in the for loop.

Code: Select all

`type %WF`
If I replace it with (by example), a hard-coded filename containing a "selection", it works:

Code: Select all

"files.txt"
I think this is related to command piping acting weirdly on my computer. The command below is not working as expected (pagination). The dir command completes before piping to more.

Code: Select all

dir | more
But this is working as expected (find the string):

Code: Select all

ipconfig | find "IPv4"
Thanks,
Jonathan Poulin
User avatar
jonathanpoulin
Member
Member
Posts: 131
Joined: 2020-12-19, 12:09 UTC
Location: Saint-Marc-des-Carrières, QC Canada
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *jonathanpoulin »

2beb

Great answer using PowerShell! I tried it.

It works at least for file associated to notepad++.exe. However, for some reason for the ones associated to app like Photos.exe, it does not. In fact, I needed to add the parameter "-noe (to not exit) to make it working, as follow:

Code: Select all

[em_test_tc_open_selected_files_in_associated_app]
cmd=pwsh
param=-noe -command Get-Content "%WL"|ForEach {Invoke-Item "$_"}
I don't know why it needs that. Maybe because Photos.exe is a UWP app? It is like pwsh.exe is exiting too quickly. Strange.
Thanks,
Jonathan Poulin
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *petermad »

2pavol
I am trying to make it works, but it looks like it not reacting on holding right mouse button for 1 sec.....
I have made a video of what to do: https://tcmd.madsenworld.dk/openmultiplefiles.mp4

After you have opened the context menu you will find an Item in the top saying: Open multiple files (*.*), which you have to click

It is important that you put the internal association in the bottom of the list, otherwise it will block other associations you might have made.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
pavol
Junior Member
Junior Member
Posts: 4
Joined: 2024-07-07, 21:39 UTC

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *pavol »

2petermad

Thank you looks great your video
Trying your music on your website https://madsenworld.dk/ and it doesnt work :D, and looks like still under construction and you abandoned your site "ALTID UNDER Arbejde OMBYGNING"

Thanks everyone Have a great day
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

[OT] Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *petermad »

2pavol
Trying your music on your website
I works, if you use an old browser, that supports plugins - but I haven't had the energy to convert it to modern browser technology. Try it in Edge in IE-mode.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
jonathanpoulin
Member
Member
Posts: 131
Joined: 2020-12-19, 12:09 UTC
Location: Saint-Marc-des-Carrières, QC Canada
Contact:

Re: Custom Shortcut > Open Selected Multiple Files / execute multiple files

Post by *jonathanpoulin »

2pavol

He didn't abandoned his website. The page for Total Commander Menus is up-to-date with version 11.03, and the one for PHSM-Calendar was updated 3 days ago.
Thanks,
Jonathan Poulin
Post Reply