Skip to content

Instantly share code, notes, and snippets.

@AlexSen
Created June 5, 2017 10:13
Show Gist options
  • Save AlexSen/02f17fe0b39ae68a76f2ad7fceafe7d3 to your computer and use it in GitHub Desktop.
Save AlexSen/02f17fe0b39ae68a76f2ad7fceafe7d3 to your computer and use it in GitHub Desktop.
# Get all files/agrs passed to the script
$SourceFiles = $PsBoundParameters.Values + $args
$FilesInfo = @()
ForEach($FileFullPath in $SourceFiles)
{
# Get file directory
$File = Get-Item -LiteralPath $FileFullPath
# Calculate file MD5
$FileMD5info = Get-FileHash $File -Algorithm MD5
# Create MD5 string
$MD5String = "$($FileMD5info.Hash)`t$($File.Name)"
# Create MD5 file with Hash info
$MD5String | Out-File "$($File.FullName).MD5"
# Add MD5 String to array
$FilesInfo += $MD5String
}
# Add Files info to clipboard
$FilesInfo | clip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment