Generate and send checksums of files to clipboard only

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Generate and send checksums of files to clipboard only

Post by *Axis »

Hi.

I'm trying to hash some files grabbing their names from a temp file, %L, (inside the temp file there are the selected files from the file pane) with hashmycalc from nirsoft.

I'm using such program 'cause I want to send the file's hashes to clipboard only (in the second step, ctrl-c of selected files/hash from hashmycalc's window). It seems that TC doesn't support such feature, so:


Command: %commander_path%\utils\HashMyFiles\HashMyFiles.exe
Parameter: /files %L


It doesn't work (the same with /file %L): the program hashes the temp file "CMD1059.tmp" only and not the listed files inside such temp file (I'm using %L and not %S due the characters limit of command line)

How to do that?

Many thanks.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

HashMyFiles doesn't have an option to read file names from a file !
Look in the readme to understand the meaning of its /file parameter.

You can use tools like TCBL for example to read the list from %L
and create a batch file to run your commands for every file.
https://totalcmd.net/plugring/TCBL_1.02.html

You may also have a look on Nirsofs nircmd with paramsfile.
nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd yourcommand ~$fparam.1$
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Post by *Axis »

Horst.Epp wrote:HashMyFiles doesn't have an option to read file names from a file !
Look in the readme to understand the meaning of its /file parameter.

You can use tools like TCBL for example to read the list from %L
and create a batch file to run your commands for every file.
https://totalcmd.net/plugring/TCBL_1.02.html

You may also have a look on Nirsofs nircmd with paramsfile.
nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd yourcommand ~$fparam.1$
How to translate in tc command mode? I don't know nircmd.

Maybe with:

Command: %commander_path%\utils\nircmd.exe
Parameter: paramsfile "c:\temp\folders.txt" "" "" %commander_path%\utils\HashMyFiles\HashMyFiles.exe %L ~$fparam.1$


My head hurts :lol:

Thanks Horst
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6482
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

Axis wrote:
Horst.Epp wrote:HashMyFiles doesn't have an option to read file names from a file !
Look in the readme to understand the meaning of its /file parameter.

You can use tools like TCBL for example to read the list from %L
and create a batch file to run your commands for every file.
https://totalcmd.net/plugring/TCBL_1.02.html

You may also have a look on Nirsofs nircmd with paramsfile.
nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd yourcommand ~$fparam.1$
How to translate in tc command mode? I don't know nircmd.

Maybe with:

Command: %commander_path%\utils\nircmd.exe
Parameter: paramsfile "c:\temp\folders.txt" "" "" %commander_path%\utils\HashMyFiles\HashMyFiles.exe %L ~$fparam.1$


My head hurts :lol:

Thanks Horst
No I would guess like this:
Parameter: paramsfile "%L" "" "" execmd %commander_path%\utils\HashMyFiles\HashMyFiles.exe ~$fparam.1$

Look into the help for the Nircmd.
It contains some example like this:

paramsfile [Parameters File] [Delimiters]
[NirCmd Command]
This powerfull command allows you to execute NirCmd Command multiple times, by loading one or more parameters from a text file. The text file can be comma-delimited, tab-delimited, semicolon-delimited, or delimited by any char that you specify in [Delimiters] parameter.
Here's an example... Let's say that you have the following text file, containing user names and passwords, delimited by comma:

user01, 123456
user02, abcfg
user03, 5fr23
user04, 33333

The following NirCmd commands sequence will create 4 users with the specified user-names and passwords (by using 'net user' command provided by Windows 2000/XP operating system)
nircmd.exe paramsfile "c:\temp\users.txt" "," "" execmd net user ~$fparam.1$ ~$fparam.2$ /add

The ~$fparam.1$ specifies the first entry in each line - the user name. The ~$fparam.2$ specifies the second entry in each line - the password.

Examples:

paramsfile "c:\temp\folders.txt" "" "" execmd md ~$fparam.1$
paramsfile "c:\temp\shortcuts.txt" "," "~q" shortcut ~$fparam.1$ "~$folder.desktop$" ~$fparam.2$
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1372a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

By the way, your Windows box should have the clip command available (just enter "clip /?" in a command shell). This command can be used to redirect console output into the clipboard.

In your case, you could write a batch file in which you call your CRC tool and let it write the CRCs into a crc file which is then again piped into the clipboard using "clip". Finally, as last command in the batch file should remove the crc file. Voila...
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Post by *Axis »

Arghhhh!! How many things I still need to learn... :oops: :shock:

Thank you guys
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

As a follow up to my last post, a batch file using "clip" could be very simple; something similar to this pseudo-code example:

Code: Select all

@set TempCrcFile=crc_%time::=.%.temp
@set TempCrcFile="%temp%\%TempCrcFile:,=.%"
@MyCrcTool.exe <allTheFilesFromTheList> %TempCrcFile%
@type %TempCrcFile% | clip
@del /q %TempCrcFile%
(My code sample here is untested and unverified. It might contain typing errors. Beware! ;) )
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Generate and send checksums of files to clipboard only

Post by *nsp »

Axis wrote:Hi.

I'm trying to hash some files grabbing their names from a temp file, %L, (inside the temp file there are the selected files from the file pane) with hashmycalc from nirsoft.

I'm using such program 'cause I want to send the file's hashes to clipboard only (in the second step, ctrl-c of selected files/hash from hashmycalc's window). It seems that TC doesn't support such feature, so:


Command: %commander_path%\utils\HashMyFiles\HashMyFiles.exe
Parameter: /files %L


It doesn't work (the same with /file %L): the program hashes the temp file "CMD1059.tmp" only and not the listed files inside such temp file (I'm using %L and not %S due the characters limit of command line)

How to do that?

Many thanks.
to use /files with hash my files you need to use the %P%S to have sequence of file and not a fileilst file.
this is a bat you can do

Code: Select all

program : hash_to_clip.bat
parameters: %P%S

-- file hash_to_clip.bat
@<PATH-TO>hashmyfiles /files %* /stext %TEMP%\hash.clip && clip <%TEMP%\hash.clip && del /f %TEMP%\hash.clip
if you want to do it with a huge number of file, you will have to do it file by file and concatenate at each step...

with tcbl, you can use 32bit wdx to hash your file and build your own text output format.
Post Reply