:: *****************************************************************************************************************************************************************
:: 20240103
:: 该脚本可以获取文件Hash value并自动生成一个HashValue.txt文档,可用于测BIOS Connect或测DU/DCU等需要更改xml里的Hash值的case.
:: 注意:要把所需获取Hash值的文件同该脚本放在同一路径下,才能直接运行该脚本.不然则要修改脚本有关文件的对应路径.
:: 作者: Darren Zhang
:: *****************************************************************************************************************************************************************
@echo off
echo.
echo start powershell
echo.
echo.**********************************************************************************************************************
:start
echo Please enter the file name which you want to use :
echo (Review tips: You can press "Tab" key to switch out the file name)
set /p "file="
echo.
if "%file%"=="" goto start
if exist %file% (goto Get-HashValue) else (goto COL)
:Get-HashValue
echo.
echo Start getting Hase Value ......
powershell Get-FileHash %file% -Algorithm MD5 > HashValue.txt
powershell Get-FileHash %file% -Algorithm SHA1 >> HashValue.txt
powershell Get-FileHash %file% -Algorithm SHA256 >> HashValue.txt
echo **********************************************************************************************************************
echo The Hash value of the %file% has been obtained!
goto Pause
echo.
:COL
echo.
echo **********************************************************************************************************************
echo %file% file not found!
echo.
echo ****** Please choose to continue or leave ******
CHOICE /C YN
if errorlevel 2 goto Exit
echo Please put %file% file in this path then continue!
ping 127.0.0.1 -n 5 >nul
cls
goto start
:Pause
pause
:Exit
exit