New command to execute batchfiles from the clipboard

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
CopyCats
Member
Member
Posts: 195
Joined: 2003-02-05, 13:09 UTC
Location: Netherlands
Contact:

New command to execute batchfiles from the clipboard

Post by *CopyCats »

Something that I do quite regularly, is to select a range of files in Total Commander and then copy/paste their names into my text editor to create a batch file.
(using the cm_CopyFullNamesToClip command, through a button, which copies the full names of the selected files to the clipboard).

However, when I have finished editing this batchfile, I have to give it a name, save it in the correct folder, execute it, and then delete it afterwards.

It would be much easier if I could just copy my finished batchfile to the clipboard, and then tell Total Commander to execute it from there..

Any supporters? :)

Regards,

-Daan-
#5050 :: Everyone who believes in telekinesis, raise my hand!
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3896
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

tell Total Commander to execute it from there
Well, TC does not execute anything.
The batch is executed by the command processor of your operating system.
TC just calls the command processor.

This means it is up to Windows to execute code from the clipboard ... bad cards.
#5767 Personal license
User avatar
CopyCats
Member
Member
Posts: 195
Joined: 2003-02-05, 13:09 UTC
Location: Netherlands
Contact:

Post by *CopyCats »

You are missing the point. Obviously, TC would save the batchfile, have it run and then delete it.

The point is that TC would do this transparantly, taking the trouble out of the user's hands and saving him time.
#5050 :: Everyone who believes in telekinesis, raise my hand!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

You can try my makebat plugin: It creates one or more lines in a batch file for each selected file, and then stores the batch for execution.

You can find it here:
http://www.ghisler.com/plugins.htm
Author of Total Commander
https://www.ghisler.com
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Or a simple AHK script instead of batch.
Command:%USERPROFILE%\Documents\AutoHotkey\TC_AHKRun.ahk
Parameters: notepad.exe %UL

Code: Select all

;
;  TC_AHKRun.ahk
;
command=%1%
inputFile=%2%
Loop, Read, %inputFile%
{
	Run, %command% %A_LoopReadLine%
	fileList:=fileList "`n" A_LoopReadLine ; Example to append the lines of input file into a list.
}
MsgBox, %fileList% ; Output the example List
Which doesn't suffer from batch/cmd's mishandling of quotes or unicode.
User avatar
CopyCats
Member
Member
Posts: 195
Joined: 2003-02-05, 13:09 UTC
Location: Netherlands
Contact:

Post by *CopyCats »

Hi Christian!

Thanks for the suggestion of using Makebat, but its workflow doesn't improve much upon my current method (of using cm_CopyFullNamesToClip, then pasting the filenames into my text editor and saving it as a batchfile).

The reason why I suggested an internal solution is because ultimately, Total Commander's purpose is to make life easier for people who deal with files a lot. With basic tasks like Copy or Move or Change Properties, it does an excellent job both for single and multiple files. However, for more 'exotic' purposes (e.g. running Grep, Cacls, Exiftool or other command line tools on a number of files) there's only the command line, which is not very practical for multi-file operations. So, that is what I feel is still missing in Total Commander: easier non-standard processing of multiple files.

What I requested above -the ability to simply paste a batch of commands into TC, which it then executes- would be a nice help. I made another (better) suggestion that would basically serve the same purpose by making the command line multi-file capable by repeating the command for each selected file. See http://www.ghisler.ch/board/viewtopic.php?t=34402.

However, an even nicer way of improving TC's multi-file capabilities might be to offer the user a Batch Builder. It could look similar to the Multi Rename Tool, in that it would take the selected files and show them as a list. You could then enter (or browse to) a command that is inserted before each filename, and a parameter that is added behind each filename, and then you would simply push 'Run' to execute the batch. I can think of a few useful options (e.g. use full pathnames; execute from: current / parent / program / other folder; protect against too long command lines; keep CMD window open; redirect output to textfile; save as template, etc) but in all, it would seem fairly easy to implement and I think it would help many users to save a lot of time.

Balderstrom: I really appreciate your comments and effort to help me, but I'm not looking for technical support, nor for external kludges. It's simply a suggestion for Christian's consideration (and for others to say Yes or Nay, or to tag on with further ideas) and I hope this message made it clear why I believe that better multiple-file capabilities deserve a place in the Commander itself.
#5050 :: Everyone who believes in telekinesis, raise my hand!
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I don't think it is too much useful feature to integrate it into TC, and it may be easilly done via multiple external tools.
User avatar
nsp
Power Member
Power Member
Posts: 1951
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: New command to execute batchfiles from the clipboard

Post by *nsp »

CopyCats wrote:Something that I do quite regularly, is to select a range of files in Total Commander and then copy/paste their names into my text editor to create a batch file.
(using the cm_CopyFullNamesToClip command, through a button, which copies the full names of the selected files to the clipboard).

However, when I have finished editing this batchfile, I have to give it a name, save it in the correct folder, execute it, and then delete it afterwards.

It would be much easier if I could just copy my finished batchfile to the clipboard, and then tell Total Commander to execute it from there..

Any supporters? :)

Regards,

-Daan-
Did you get a look at TCBL ?

See http://ghisler.ch/board/viewtopic.php?t=9374 and/or http://tccfestuff.free.fr/

It is written exactly for this purpose, ability to build bat from file list and execute it afterwards deleting automatically the script. It even allows you to launch an editor to polish your script before execution. It also let the clipboard untouched !

Some open source Ahk solutions are similar and works great !
Post Reply