完美解决了
@echo off
::【导出注册表为:需修改.reg】
set /p 注册表路径=【右键】粘贴注册表路径:
reg query "%注册表路径%" /s >需修改.reg
::***************************************
::【修改:需修改.reg 变成:有路径.reg】
>有路径.reg (
echo Windows Registry Editor Version 5.00
echo=
)
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
_________________________________________________________________________________________
原来的问题:
需要修改的1.reg(蓝色内容不是固定的):