Win11系统设置文件右键添加系统自带工具计算md5值

bat脚本管理员身份运行该脚本

@echo off
:: 以管理员身份运行脚本检查
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo need root!
    pause
    exit /b 1
)

:: 添加计算 MD5 到右键菜单
reg add "HKEY_CLASSES_ROOT\*\shell\Calculate MD5" /ve /d "Calculate MD5" /f
if %errorLevel% neq 0 (
    echo add right key error!
    pause
    exit /b 1
)

reg add "HKEY_CLASSES_ROOT\*\shell\Calculate MD5" /v "Icon" /d "imageres.dll,-5372" /f
if %errorLevel% neq 0 (
    echo set icon error!
    pause
    exit /b 1
)

:: 使用 CertUtil -hashfile 命令计算 MD5
reg add "HKEY_CLASSES_ROOT\*\shell\Calculate MD5\command" /ve /d "cmd /c CertUtil -hashfile \"%%1\" MD5  & pause" /f
if %errorLevel% neq 0 (
    echo set command error!
    pause
    exit /b 1
)

echo success!
pause

你可能感兴趣的:(linux,服务器,运维)