|
|
发表于 2023-8-13 10:27:41
|
显示全部楼层
回复 1# 56335571
请参考Q-04把bat文件保存为ANSI编码:
https://mp.weixin.qq.com/s/Koje4FufWxWBs7ioDy_LJA
Test1-MD5.bat- @echo off
- set "StrOld=123"
- set /p "=%StrOld%" >"%temp%\1.txt" <nul
- for /f "delims=" %%i in ('certutil -hashfile "%temp%\1.txt" MD5 ^| find /v " "') do (
- set "StrNew=%%i"
- )
- echo,%StrNew%
- pause
复制代码 Test2-MD5.bat- @echo off
- set "StrOld=123"
- for /f "delims=" %%i in ('powershell "[Security.Cryptography.HashAlgorithm]::Create('MD5').ComputeHash([Text.Encoding]::UTF8.GetBytes('%StrOld%')) | ForEach-Object{Write-Host -n $_.ToString('x2')}"') do (
- set "StrNew=%%i"
- )
- echo,%StrNew%
- pause
复制代码 |
|