Board logo

标题: [其他] [已解决]批处理提取16进制字节到TXT文本? [打印本页]

作者: a574045075    时间: 2019-11-25 13:47     标题: [已解决]批处理提取16进制字节到TXT文本?

本帖最后由 a574045075 于 2019-11-25 16:10 编辑


如何把若干个nds文件的000Ch-000Fh位置批量提取到TXT文本?

处理后的文本.

作者: terse    时间: 2019-11-25 15:00

本帖最后由 terse 于 2019-11-25 15:07 编辑
  1. $Files = [System.IO.Directory]::EnumerateFiles("$pwd","*.txt")
  2. ForEach($File in $Files )
  3. {
  4.     $Hex = [System.BitConverter]::ToString([IO.File]::ReadAllBytes( "$File")[12..15]) -replace '-', ''
  5.     [IO.File]::AppendAllText("1.txt","$Hex`n")
  6. }
复制代码

作者: flashercs    时间: 2019-11-25 15:26

  1. powershell -Command "Get-Item -Path .\*.nds -Filter *.nds | ForEach-Object -Begin { $buff = New-Object System.Byte[] -ArgumentList 4; } -Process { if (!$_.PSIsContainer) { try { $stream = $_.OpenRead(); [void]$stream.Seek(0xc, [System.IO.SeekOrigin]::Begin); $readcount = $stream.Read($buff, 0, $buff.Length); [bitconverter]::ToString($buff, 0, $readcount).Replace('-', ''); }finally { if ($stream) { $stream.Dispose(); } } } } | Set-Content .\1.txt"
复制代码

作者: czjt1234    时间: 2019-11-25 15:52

PS太强大了,现在黑客都是PS




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2