HELP

Any other tech-related topics
Post Reply
Message
Author
User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

HELP

#1 Post by Local »

Does anybody know ow to export multiple reg keys to one .reg file using a cmd (batch) command?

I've Googled til my eyes are sore but the only answer I can see is on Experts Exchange and I'm not gonna pay to be told it's not possible.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#2 Post by m^(2) »

Maybe use reg.exe to create multiple .reg files, then

Code: Select all

find /v "Windows Registry Editor Version" %%name>_%%name
for each but first .reg and finally - concatenate the first with all newly created ones?

User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

#3 Post by Local »

Thanks m^(2), as usual you're way ahead of me here.

I'm using this for a simple portable launcher (I don't get on with Nsis or Autohotkey) so the separate application may be too much.

I've already exported to separate reg files using the regedit E/ switch how can I merge them?
Is this a manual process or a Reg.exe capability?

Also
(too many questions I know)
will it be worth it just to make the data folder look neater?

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#4 Post by m^(2) »

Manual process.
Untested code:

Code: Select all

::before using the code below, use reg.exe to have all .reg files in the current directory
set passed_first=false
for %%reg in .\*.reg  do call :behead_reg %%reg
for %%reg in .\*.reg_ do call :append_reg %%reg
goto:eof

:behead_reg
if "%passed_first%"=="false" (
    set passed_first=true
    set first=%1
) else (
    find /v "Windows Registry Editor Version" %1>%1_
    del %1
)
goto :eof

:append_reg
if NOT "%1"=="%first%" (
    echo %1>>%first%
    del %1
)
goto :eof

Post Reply