找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 28344|回复: 3

[其他] [已解决]批处理提取16进制字节到TXT文本?

[复制链接]
发表于 2019-11-25 13:47:28 | 显示全部楼层 |阅读模式
本帖最后由 a574045075 于 2019-11-25 16:10 编辑


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

处理后的文本.
发表于 2019-11-25 15:00:31 | 显示全部楼层
本帖最后由 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. }

复制代码
发表于 2019-11-25 15:26:50 | 显示全部楼层
  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"
复制代码

评分

参与人数 1技术 +1 收起 理由
a574045075 + 1 谢谢

查看全部评分

发表于 2019-11-25 15:52:09 | 显示全部楼层
PS太强大了,现在黑客都是PS
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-19 11:39 , Processed in 0.017624 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表