rahuebner wrote: 2022-10-08, 11:12 UTC
Is it possible to show the Checksums instead of writing to files?
You can do many things with TCs' parameter and a scripting language of your choice.
Here is a copy&pate button-code with posh-code for example:
Code: Select all
TOTALCMD#BAR#DATA
PowerShell -NoProfile -NoExit
Get-FileHash '%N' -Algorithm MD5 ; 'done'
powershell
Get-FileHash %P%N -Algorithm MD5 for one selected file
-1
(%N is TC parameter and must be set into quotes ' %N ' if the file could contain spaces)
Example output in a black DOS/PoSh-box:
Code: Select all
Algorithm Hash Path
--------- ---- ----
MD5 69B0AB5B80A4B8D38849367C2F457DC1 D:\text\wget-1.17.1-win32\wget-1-17-1-x86.exe
done
PS D:\text\wget-1.17.1-win32>
- - -
For one-or-many selected files:
type '%F' | ForEach{...} , (%F is TC parameter, set it in single quotes, or triple double quotes)
Code: Select all
PowerShell -NoProfile -noexit
type '%F' | ForEach{Get-FileHash $_ -Algorithm MD5}
Result:
Algorithm Hash Path
--------- ---- ----
MD5 69B0AB5B80A4B8D38849367C2F457DC1 D:\text\wget-1.17.1-win32\wget-1-17-1-x86.exe
MD5 CD3E4DD83C2AFF96206EBDEC13C9FB9A D:\text\wget-1.17.1-win32\wget-1-17-1-x86.exe.debug
MD5 8EE44646660F2159D9A8C88CD4C6A8EC D:\text\wget-1.17.1-win32\wget-1-17-1-x86.html
MD5 321C6C46E38440224BA0197991CB9879 D:\text\wget-1.17.1-win32\wget-1-17-1-x86.ini.sample
The same, but output to _hashes.txt:
(%F is TC parameter and is surrounded by single quotes)
Code: Select all
PowerShell -NoProfile
type '%F' | ForEach{Get-FileHash $_ -Algorithm MD5} >"_hashes.txt"
- - -
- - - or even copy the hash of the one selected file automatically to the clipboard:
(%N is TC parameter)
Code: Select all
TOTALCMD#BAR#DATA
PowerShell -NoProfile
(Get-FileHash '%N' -Algorithm MD5).hash | clip
powershell
Get-FileHash "%N" -Algorithm MD5 -- copy to clipboard
1
-1
- - -
%P%N will be auto quoted by TC if space is found.
'%N' need to be quoted by yourself if space could happen.
For PoSh in TC, quotes must be tripled """...""", or use single quotes '...'
"Get-FileHash" will need PowerShell v4 or younger.
References:
https://stackoverflow.com/questions/10521061/how-to-get-an-md5-checksum-in-powershell
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-7.2
-Algorithm
SHA1
SHA256
SHA384
SHA512
MD5
see my sig for more