小编Sta*_*cey的帖子

PowerShell(或 CMD)中的 md5 散列与相对文件路径

我想将目录及其子目录中所有文件的 md5 哈希写入文件。理想情况下,复制 unix 命令的输出find . -type f -exec md5sum {} +(即两列:哈希值和相对文件路径)。

我正在查看 CMD 命令,CertUtil -hashfile afile.txt MD5 但我被dir /A:-D /B /S. 我使用 PowerShell 发现了以下响应:https : //superuser.com/a/1249418。我很少使用 CMD,这是我第一次尝试 PowerShell。

Get-FileHash -Algorithm MD5 -Path (Get-ChildItem "*.*" -Recurse | Resolve-Path -Relative | Tee-Object -Variable y) | select hash | Out-File C:\Users\MYUSERNAME\Desktop\MYFOLDER\temphashes.txt
$x = (Get-Content C:\Users\MYUSERNAME\Desktop\MYFOLDER\temphashes.txt).ToLower() | select -skip 3 | ?{$_.Trim(" `t")}
$i = 0; $x | ForEach-Object {($_, $y[$i]) -join " "; $i++} | …
Run Code Online (Sandbox Code Playgroud)

powershell cmd

4
推荐指数
1
解决办法
1465
查看次数

标签 统计

cmd ×1

powershell ×1