Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- # open the hashes file
- $reader = [System.IO.File]::OpenText("hashes.txt")
- # first line is the file path
- $filePath = $reader.ReadLine();
- while ($filePath -ne $null) {
- [Console]::Out.Write($filePath + " ... ")
- $actualHash = Get-FileHash $filePath
- $actualHash = $actualHash.Hash
- # next line is just the size, which we don't care about
- $ignore = $reader.ReadLine();
- # next line is the real hash
- $realHash = $reader.ReadLine();
- if ($realhash -eq $actualHash) {
- "OK!"
- }
- else
- {
- "No!"
- "`tExpected: [" + $realHash + "]"
- "`tActual : [" + $actualHash + "]"
- }
- # move on to the next file
- $filePath = $reader.ReadLine()
- }
- }
- catch
- {
- $_
- }
- finally {
- $reader.close()
- "Done!"
- pause
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement