Can I make a button to run the cmd for all selected files?
Moderators: white, Hacker, petermad, Stefan2
Can I make a button to run the cmd for all selected files?
Hi!
What I want is to run the command N times for all selected files. Unlike %P%S, which only appends all of them.
(Some programs don't understand multiple input files)
What I want is to run the command N times for all selected files. Unlike %P%S, which only appends all of them.
(Some programs don't understand multiple input files)
Windows 10
Sure. If your program supports a list file, you can make a button that calls your program directly and passes the list via %L, %WL or %UL respectively.
If it doesn't support file lists directly, you can still use a CMD for-loop to process all files. Something like this:But make sure it's a CMD (console) program because if it isn't, the code above will start an instance for each file simultaneously.
Also note that things like this have been discussed in the past, so you can find other solutions in the forum.
Regards
Dalai
If it doesn't support file lists directly, you can still use a CMD for-loop to process all files. Something like this:
Code: Select all
@echo off
if "%~1"=="" goto :EOF
for %%L IN (%~1) DO (
call D:\rive\and\path\to\your\program\here.exe "%%~L"
)
Also note that things like this have been discussed in the past, so you can find other solutions in the forum.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Thanks!Dalai wrote:Sure. If your program supports a list file, you can make a button that calls your program directly and passes the list via %L, %WL or %UL respectively.
If it doesn't support file lists directly, you can still use a CMD for-loop to process all files. Something like this:But make sure it's a CMD (console) program because if it isn't, the code above will start an instance for each file simultaneously.Code: Select all
@echo off if "%~1"=="" goto :EOF for %%L IN (%~1) DO ( call D:\rive\and\path\to\your\program\here.exe "%%~L" )
Also note that things like this have been discussed in the past, so you can find other solutions in the forum.
Regards
Dalai
Though it's a nasty workaround. Which I assume you need to keep as separate batch file and can't be tinkered into the button.
Windows 10
Workaround? Well, if you want to call it that. Which way would you go instead when some program doesn't process a list file by itself, and takes only one argument? It's a simple mechanism to use some kind of script, be it CMD, VBS, PowerShell, AutoIt, AutoHotkey or something else.
Maybe MakeBat is a better way? I don't know how this works, but I'm quite sure there's some info on the forum already.
Regards
Dalai
Maybe MakeBat is a better way? I don't know how this works, but I'm quite sure there's some info on the forum already.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Well, I was hoping TC had another special parameter of which I was unaware of. And I could just %P%X or such.Dalai wrote:Workaround? Well, if you want to call it that. Which way would you go instead when some program doesn't process a list file by itself, and takes only one argument? It's a simple mechanism to use some kind of script, be it CMD, VBS, PowerShell, AutoIt, AutoHotkey or something else.
Maybe MakeBat is a better way? I don't know how this works, but I'm quite sure there's some info on the forum already.
Regards
Dalai
Windows 10
I don't think that it's a file manager's job, at least not one without advanced scripting/macro capabilities, to launch a program for every selected file. And I also don't think it's necessary because there are plenty of options available to do such things - the most important ones mentioned above. It were a different story if TC had more dedicated scripting features, but that would TC make more complex, which would lead to even more bugs.
Regards
Dalai
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Can I make a button to run the cmd for all selected file
You can try TCBL tool, it is designed for this purpose. As TC do not have any script language nor any switch to run for each selected file.avada wrote:Hi!
What I want is to run the command N times for all selected files. Unlike %P%S, which only appends all of them.
(Some programs don't understand multiple input files)
Or build any intermediate powershel/scriptl launcher using the generated list File.
You will have some limitation if not working on standard file.
2avada
Here are two buttons for you with notepad as the command (replace with your program) - the first one opens all selceted files in notepad at the same time, the second button opens them one after another.Which I assume you need to keep as separate batch file and can't be tinkered into the 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 %%windir%%\notepad.exe "%%n"
wcmicons.dll,28
Open all selected files in notepad at the same time
1
-1
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 call %%windir%%\notepad.exe "%%n"
wcmicons.dll,28
Open all selected files in notepad one after another
1
-1
The chcp 65001 && %%COMSPEC%% /C part is for supporting Unicode in the filenames - remove it if you are using Windows XP (some still do)To make the buttons:
1. Mark the green text above (including TOTALCMD#BAR#DATA in the first line and -1 in the last line).
2. Copy it to the ClipBoard (Ctri+C).
3. Right click on TC's buttonbar and choose "Paste".
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Hmmm...petermad wrote:2avadaHere are two buttons for you with notepad as the command (replace with your program) - the first one opens all selceted files in notepad at the same time, the second button opens them one after another.Which I assume you need to keep as separate batch file and can't be tinkered into the 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 %%windir%%\notepad.exe "%%n" wcmicons.dll,28 Open all selected files in notepad at the same time 1 -1
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 call %%windir%%\notepad.exe "%%n" wcmicons.dll,28 Open all selected files in notepad one after another 1 -1
The chcp 65001 && %%COMSPEC%% /C part is for supporting Unicode in the filenames - remove it if you are using Windows XP (some still do)To make the buttons:
1. Mark the green text above (including TOTALCMD#BAR#DATA in the first line and -1 in the last line).
2. Copy it to the ClipBoard (Ctri+C).
3. Right click on TC's buttonbar and choose "Paste".
I can't seem to get this to work. Something with the path for the program I test it with. I replaced
Code: Select all
%%windir%%\notepad.exe
Code: Select all
"E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe"
Windows 10
2avada
Try and put your program in a folder that does not use accented characters like á, í and ő and see if that helps...
Try and put your program in a folder that does not use accented characters like á, í and ő and see if that helps...
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Then try and set an environment variable for the program, like:
editor=E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe
You can run SystemPropertiesAdvanced.exe to do that. Remembert to restart TC after that, so it can now the variable.
Example:
editor=E:\alkalmazások - telepítők\Bittorrent\bencode\BEncode Editor.exe
You can run SystemPropertiesAdvanced.exe to do that. Remembert to restart TC after that, so it can now the variable.
Example:
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 "%%editor%%" "%%n"
wcmicons.dll,28
Open all selected files in notepad at the same time
1
-1
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
I know but quotes don't help. And renaming/moving files is not viable, even though it works that way.isidro wrote:if there are spaces on either path or filename you will need to enclose all in ""
You may try first putting and renaming editor in a simpler way (with no spaces/strange chars on name or path) (ie: C:\UT\myeditor.exe)
Windows 10