完美解决了
@echo off
cd /d X:\Users\Default\Desktop\"
::【导出注册表为:需修改.reg】
set /p 注册表路径=【右键】粘贴注册表路径:
reg query "%注册表路径%" /s >需修改.reg
::***************************************
::【修改:需修改.reg 变成:有路径.reg】
echo Windows Registry Editor Version 5.00>有路径.reg
echo=>>有路径.reg
for /f "tokens=1 delims=[]" %%a in ('find /n "默认" ^<"需修改.reg"') do (
set _"%%a"=1)
(for /f "tokens=1* delims=[]" %%a in ('find /n /v "" ^<"需修改.reg"') do (
if "%%b" equ "" (
echo=) else if not defined _"%%a" (
echo [%%b]) else (
for /f "tokens=1-2*" %%c in ("%%b") do (
set str=%%e
setlocal enabledelayedexpansion
echo=@="!str:\=\\!"
endlocal))))>>有路径.reg
del 需修改.reg
::***************************************
::【“有路径.reg”第5行后插入:"Icon"=】
set "插入行=5" /// 插入到哪一行后面
set "文件=有路径.reg"
for %%a in ("%文件%") do set /a Total += 1
for /f "delims=" %%s in ('dir /a:-d /b "%文件%"') do (
set /a Line = 0, Count += 1
cls
call echo 正在处理第 %%Count%% 个文件(共 %Total% 个)
findstr /n .* "%%s" | findstr /bv "%删除行: =: %:" > "%temp%\.tmp"
(
for /f "usebackq delims=" %%t in ("%temp%\.tmp") do (
set Var=%%t
set /a Line += 1
SetLocal EnableDelayedExpansion
echo,!Var:*:=!
if !Line!==%插入行% (
echo,"Icon"=
echo,;【上1行可添加图标路径】)
EndLocal)) > "%%s")
del "%temp%\.tmp"
start "" d:\pe整理碎片(很好)\修改pe\程序\notepad2\notepad2.exe 有路径.reg
exit
_________________________________________________________________________________________
原来的问题:
目前:
regedit /e "X:\Users\Default\Desktop\1.reg" HKEY_CLASSES_ROOT\Imagine.PNG\shell\抓滚动
导出的注册表1.reg:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Imagine.PNG\shell\抓滚动]
@="抓滚动"
[HKEY_CLASSES_ROOT\Imagine.PNG\shell\抓滚动\command]
@=hex(2):44,00,3a,00,5c,00,31,00,ff,7e,72,82,6f,8f,f6,4e,5c,00,1a,59,92,5a,53,\
4f,5c,00,93,62,fe,56,93,62,da,6e,a8,52,5c,00,93,62,da,6e,a8,52,46,00,53,00,\
43,00,61,00,70,00,74,00,75,00,72,00,65,00,39,00,37,00,5c,00,46,00,53,00,43,\
00,61,00,70,00,74,00,75,00,72,00,65,00,2e,00,65,00,78,00,65,00,00,00
从这里看不到程序路径
—————————————————————————————————————————————
希望运行一个命令,导出的注册表中看到程序路径,形如:
Windows Registry Editor Version 5.00