From f26d09bf9f6617a05bf49d8b4d69d0ca8b7fb87e Mon Sep 17 00:00:00 2001 From: Bruce Wayne Date: Sat, 10 Oct 2020 20:08:33 +0800 Subject: [PATCH] Update GetSHA256.ps1 --- GetSHA256.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GetSHA256.ps1 b/GetSHA256.ps1 index 71051256..a85c0ba8 100644 --- a/GetSHA256.ps1 +++ b/GetSHA256.ps1 @@ -1,5 +1,6 @@ param([string]$file) $hash = [Security.Cryptography.HashAlgorithm]::Create( "SHA256" ) -$stream = ([IO.StreamReader]$file).BaseStream --join ($hash.ComputeHash($stream) | ForEach { "{0:x2}" -f $_ }) -$stream.Close() +$path = (Resolve-Path -Path $file).Path +$stream = ([IO.StreamReader]$path).BaseStream +-join ($hash.ComputeHash($stream) | ForEach-Object { "{0:x2}" -f $_ }) +$stream.Close() \ No newline at end of file