Compute the hash value for a file by using a specified hash algorithm.
:: Generate File Hash :: :: The "Get-FileHash" cmdlet Computes the hash value for a file by using a :: specified hash algorithm. :: :: The default hashing algorithm is SHA256, but you can use any of the following :: algorithms: :: :: - SHA1 :: - SHA256 :: - SHA384 :: - SHA512 :: - MACTripleDES :: - MD5 :: - RIPEMD160 :: Example 1 :: :: This example uses the Get-FileHash cmdlet to compute the hash value for the :: Powershell.exe file. The hash algorithm used is the default, SHA256. The output :: is piped to the Format-List cmdlet to format the output as a list. Get-FileHash $pshome\powershell.exe | Format-List :: Example 2 :: :: This command uses the Get-FileHash cmdlet and the SHA384 algorithm to compute :: the hash value for an ISO file that an administrator has downloaded from the :: Internet. The output is piped to the Format-List cmdlet to format the output :: as a list. Get-FileHash Contoso8_1_ENT.iso -Algorithm SHA384 | Format-List :: Example 3 :: :: Running the Powershell command from a batch file: @echo off if exist "%1" ( echo. echo.Generating hash... PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "& Get-FileHash '%1' -Algorithm SHA256 | Format-List" ) else ( echo.File not found. ) pause