Page 1 of 1

Windows 10 20H2 and hash file

Posted: 16 Jan 2021 12:11
by balubeto
Hi

Using Windows 10 20H2, how can I create a script that, starting from a local or network directory, parses all its subdirectories creating a text file containing all the file names with the corresponding SHA1 hashes next to them?

Thanks

Bye

Re: Windows 10 20H2 and hash file

Posted: 16 Jan 2021 21:27
by Compo
One possible, but potentially slow solution, is to use the built-in certutil utility.

Code: Select all

@(For /F Delims^=^ EOL^= %%G In ('Dir /B/S/A-D "E:\SourceDir"')Do @If %%~zG==0 (Echo da39a3ee5e6b4b0d3255bfef95601890afd80709 *%%G)Else For /F %%H In ('%__AppDir__%\certutil.exe -hashfile "%%G"^|%__AppDir__%\find.exe /V ":"')Do @Echo %%H *%%G)>"%UserProfile%\Destination\hashed.txt"
Just change E:\SourceDir and %UserProfile%\Destination\hashed.txt to your own source and destinations.

*Please note balubeto: I have seen many of your questions before, and will not be making any changes, or answering any questions regarding this snippet.*

Re: Windows 10 20H2 and hash file

Posted: 16 Jan 2021 22:23
by Squashman
balubeto wrote:
16 Jan 2021 12:11
Hi

Using Windows 10 20H2, how can I create a script that, starting from a local or network directory, parses all its subdirectories creating a text file containing all the file names with the corresponding SHA1 hashes next to them?

Thanks

Bye
Almost 10 years on these forums and you still pretty much just ask a question without ever even making an attempt at solving the problem yourself. People are more inclined to help other people when they have shown some effort of solving the problem on their own.
I bet if you would have searched the forums you might have found: HASHSUM.BAT

Re: Windows 10 20H2 and hash file

Posted: 17 Jan 2021 11:00
by Compo
balubeto, as you have definitely read the responses to your question, (because you've already posted in the thread linked to in the second response), and taking account that responses are for the community, not just for you, I would have expected you to try the answer I provided and posted with relevant feedback.

I have, since posting my answer, checked the code I provided in Windows 10 Pro, Version 20H2, (build 19042.746). The exact version you provided in your question title and body, and verified that the output is returned as intended.

Please show me the courtesy of trying my code, and letting the community know whether it achieves the intended aim, thank you.