Skip to content

Instantly share code, notes, and snippets.

@jordanrobot
Created September 16, 2021 14:01
Show Gist options
  • Select an option

  • Save jordanrobot/440c087f3551302d3c6d236101ece1bc to your computer and use it in GitHub Desktop.

Select an option

Save jordanrobot/440c087f3551302d3c6d236101ece1bc to your computer and use it in GitHub Desktop.
Compares the hashes of two files
param(
[string]$fileA,
[string]$fileB
)
if ((!($fileA)) -or (!(Test-Path $fileA -PathType Leaf)))
{$fileA=Read-Host "Enter First File to Compare"}
if ((!($fileB)) -or (!(Test-Path $fileB -PathType Leaf)))
{$fileB=Read-Host "Enter Second File to Compare"}
if((Get-FileHash $fileA).hash -ne (Get-FileHash $fileB).hash)
{"files are different"}
Else {"Files are the same"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment