I am writing a Windows batch file to copy a file from my computer to a network location, but before doing this, I need to add a hash for it using the command line. Assuming that my file is named testing.zip, how can this be done?

  • Use a command-line hashing app, generate the hash, then rename the file to include said hash. That seems like common sense so where are you getting stuck? Edit: On re-reading your question, what exactly do you mean by "add a hash for it"? I thought you meant add the hash to the file name itself, but perhaps you mean something else entirely? If you just want to store the hash separately then most hashing apps can generate SFV or similar files. – Karan Jun 9 '15 at 14:59
  • I need to add a hash for the file before proceeding with the copying.Once copied, I need to check the hash again to make sure that the file is good and was successfully copied without any changes. – Scorpion99 Jun 10 '15 at 6:25
  • Ok, let me ask again. Where do you need to add this hash? Most any command-line hashing program can create a file listing all the generated hashes, or you can redirect its output yourself as STTR has mentioned below. So where precisely are you getting stuck? Your question is unclear. – Karan Jun 10 '15 at 7:59
Sigcheck -q -i -a -h testing.zip >> testing.md5

Sigcheck part of Windows Sysinternals

If need MD5 only:

Sigcheck -q -h testing.zip | find "MD5:" >>  testing.md5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.