Copy selected files to the command line

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
crash100177@yahoo.com
Junior Member
Junior Member
Posts: 6
Joined: 2015-09-14, 00:46 UTC

Copy selected files to the command line

Post by *crash100177@yahoo.com »

I just started to use Total Commander instead of using other explorer programs like Windows Explorer.
Right now, I copy the file names to the command line by pressing ctrl and enter for each file. I then use the results in this search (ALT+F7) to locate these files in a different directory. It's very tedious and slow to do this for each file.
Is there a way to copy multiple file names to the command line at the samet time instead of doing ctrl + enter for each file?
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If you need to select files with same names in different directory, it may be better using copy filenames to clipboard and load selection from clipboard then.

cm_CopyNamesToClip
cm_LoadSelectionFromClip
crash100177@yahoo.com
Junior Member
Junior Member
Posts: 6
Joined: 2015-09-14, 00:46 UTC

Post by *crash100177@yahoo.com »

That sounds like a more efficient way to do it. Where would you enter these commands?
This could save me so much time.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can add buttonbar buttons with them, or bind a hotkeys under Misc. page of configuration dialog.
crash100177@yahoo.com
Junior Member
Junior Member
Posts: 6
Joined: 2015-09-14, 00:46 UTC

Post by *crash100177@yahoo.com »

So I'll create this button or hotkey (I'll probably use the hotkey method) So it will put the file names under Search (Alt + F7)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

No, cm_CopyNamesToClip copies filenames to clipboard (with line break as delimiter), and cm_LoadSelectionFromClip selects files in current directory using filelist from clipboard. Search tool is not used here.
crash100177@yahoo.com
Junior Member
Junior Member
Posts: 6
Joined: 2015-09-14, 00:46 UTC

Post by *crash100177@yahoo.com »

Thank you.

How do I enter both of those commands against the button. I would like one button for both commands. Is there a delimiter to separate like ; to separate commands
cm_CopyNamesToClip;cm_LoadSelectionFromClip

Copying to clipboard under commands<copy selected names to clipboard gives me
file001
file002
file003

My end result that I would like is
file001 file002 file003

I'm trying to search for the same files with a different folder structure from the root or drive like c\, which is why I've been using the search tool.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You can do this:

Code: Select all

cm_CopyNamesToClip, cm_LoadSelectionFromClip
But it is senseless because you don't want to select files in same directory where you copy names, you want to switch dir before selecting.

If you want to copy names separated with spaces, you can use following button:

Code: Select all

Command: .
Parameters: ? %S
Here ? causes TC to confirm command line before command execution, and %S inserts filenames to it, so you can copy them from that dialog.
sgp
Senior Member
Senior Member
Posts: 355
Joined: 2005-01-31, 16:04 UTC

Post by *sgp »

MVV wrote: If you want to copy names separated with spaces, you can use following button:

Code: Select all

Command: .
Parameters: ? %S
Here ? causes TC to confirm command line before command execution, and %S inserts filenames to it, so you can copy them from that dialog.
Ingenious trick to place all names in a single line ready for copy-paste!
User avatar
nsp
Power Member
Power Member
Posts: 1952
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

sgp wrote:
MVV wrote: If you want to copy names separated with spaces, you can use following button:

Code: Select all

Command: .
Parameters: ? %S
Here ? causes TC to confirm command line before command execution, and %S inserts filenames to it, so you can copy them from that dialog.
Ingenious trick to place all names in a single line ready for copy-paste!
you can even use nircmd or ahk or whatever to set it automatically to the clipboard... you can define a user command to do this !

Code: Select all

Command: cmd /c
parameters: echo %S>"%TEMP%\tc_listfile.txt"&c:\tools\nirsoft\nircmd.exe clipboard readfile "%TEMP%\tc_listfile.txt"
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Post by *Gral »

There should be

Code: Select all

Command: cmd /c 
 parameters: echo %S>"%%TEMP%%\tc_listfile.txt"&c:\tools\nirsoft\nircmd.exe clipboard readfile "%%TEMP%%\tc_listfile.txt"
doubles percent signs for environment variables in parameters field. Also %T in your example will be interpreted as target path.

This can be achieved also very simple with CLIP.EXE utility

Code: Select all

Command: CMD.EXE /C ECHO
Parameters: %S | CLIP.EXE
Last edited by Gral on 2015-09-16, 02:35 UTC, edited 1 time in total.
crash100177@yahoo.com
Junior Member
Junior Member
Posts: 6
Joined: 2015-09-14, 00:46 UTC

Post by *crash100177@yahoo.com »

Thank you so much. It works fantastic. This will save so much time. I don't think I'll be going to Windows Explorer again. :D
Is there a Total Commander Nircmd or is this a standalone program that needs to be added as a plugin?
crash100177@yahoo.com
Junior Member
Junior Member
Posts: 6
Joined: 2015-09-14, 00:46 UTC

Post by *crash100177@yahoo.com »

Also, where do I get CLIP.EXE utility for Total Commander?
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Post by *Gral »

You can get nircmd at http://www.nirsoft.net/utils/nircmd.html

CLIP.EXE is included in every Windows, starting with Windows 2003.
Post Reply