我想保存一个结果
CertUtil -hashfile "path_to_file" MD5
在命令行命令中删除散列的空格(更详细地说,我想在VS 2015 C++的后处理命令行中使用这个)。
目前结果如下:
1) C:\Users\admin>CertUtil -hashfile ping.txt MD5
2)文件ping.txt的MD5哈希:
3) 4f 75 c2 2c 20 b4 81 54 72 2c a5 7c 95 7a 66 88
4) CertUtil:-hashfile命令执行成功。
我只需要一行3)
-将十六进制字符串保存到一个变量中,然后删除空格。非常感谢!
发布于 2016-08-05 00:01:04
尽管有上面的答案,典型的设置本地启用的延迟扩展问题
@echo off
setlocal enabledelayedexpansion
set /a count=1
for /f "skip=1 delims=:" %%a in ('CertUtil -hashfile "ping.txt" MD5') do (
if !count! equ 1 set "md5=%%a"
set/a count+=1
)
set "md5=%md5: =%
echo %md5%
endlocal
exit/B
发布于 2017-03-10 06:01:30
我对此完全是太迟了,但是使用find去掉那些不需要的代码行怎么样:
CertUtil -hashfile "path_to_file" MD5 | find /i /v "md5" | find /i /v "certutil"
发布于 2019-10-14 08:16:58
使用powershell命令:
$(CertUtil -hashfile C:\TEMP\MyDataFile.img MD5)[1] -replace " ",""
https://stackoverflow.com/questions/38771114
复制相似问题