Skip to content

Instantly share code, notes, and snippets.

@ml4den
Created January 12, 2020 23:10
Show Gist options
  • Save ml4den/d86468e7ece329f858b792b3dc0ac2c4 to your computer and use it in GitHub Desktop.
Save ml4den/d86468e7ece329f858b792b3dc0ac2c4 to your computer and use it in GitHub Desktop.
Hash a file easily with PowerShell
function FileSelector {
# Define a function that allows the user to select files.
# Credit: https://4sysops.com/archives/how-to-create-an-open-file-folder-dialog-box-with-powershell/
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = [Environment]::GetFolderPath('Desktop')
}
$null = $FileBrowser.ShowDialog()
return $FileBrowser
}
$selectedFile = FileSelector
if (-Not ($selectedFile.FileName)) {break}
Get-FileHash -Path $selectedFile.FileName | fl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment