Exporting a specific key via a batch/executable file?

G

Guest

I need to export a specific registry key (and sub-keys) before I reimage a
user's computer. Is there a way to have it export the file without opening
the registry, finding the entry, clicking export, giving it a name, etc....

Anyway to do it from a command line or make a little batch file to do it
somehow?

The key is [HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows Messaging Subsystem\Profiles]

Thanks.
 
D

Dave Patrick

regedit /e D:\filename.reg "HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Windows Messaging Subsystem\Profiles"


(above is all on one line)

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
|I need to export a specific registry key (and sub-keys) before I reimage a
| user's computer. Is there a way to have it export the file without
opening
| the registry, finding the entry, clicking export, giving it a name,
etc....
|
| Anyway to do it from a command line or make a little batch file to do it
| somehow?
|
| The key is [HKEY_CURRENT_USER\Software\Microsoft\Windows
| NT\CurrentVersion\Windows Messaging Subsystem\Profiles]
|
| Thanks.
 
G

Guest

OK, one more question. Is there a way to export multiple registry keys with
one batch file and have all the keys end up in one REG file? If I do this:

---Start Batch File---
regedit /e D:\Docs\Exchange\outlook.reg
"HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Messaging Subsystem\Profiles"
regedit /e D:\Docs\Exchange\outlook.reg
"HKEY_CURRENT_USER\Software\Microsoft\Exchange"
---Stop Batch File---

The second line overwrites the file created from the first line. Is there
any way to have it append itself to the file instead of overwriting it? Or
will I need to have each line make it's own file (outlook1.reg, outlook2.reg)
which is what I'm doing now...

Thanks.
 
D

Dave Patrick

AFAIK you would need to append the text from one file to the other through
script or other means.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| OK, one more question. Is there a way to export multiple registry keys
with
| one batch file and have all the keys end up in one REG file? If I do
this:
|
| ---Start Batch File---
| regedit /e D:\Docs\Exchange\outlook.reg
| "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
| Messaging Subsystem\Profiles"
| regedit /e D:\Docs\Exchange\outlook.reg
| "HKEY_CURRENT_USER\Software\Microsoft\Exchange"
| ---Stop Batch File---
|
| The second line overwrites the file created from the first line. Is there
| any way to have it append itself to the file instead of overwriting it?
Or
| will I need to have each line make it's own file (outlook1.reg,
outlook2.reg)
| which is what I'm doing now...
|
| Thanks.
 
M

Matthias Tacke

Mr said:
OK, one more question. Is there a way to export multiple registry keys with
one batch file and have all the keys end up in one REG file? If I do this:

---Start Batch File---
---Stop Batch File---

The second line overwrites the file created from the first line. Is there
any way to have it append itself to the file instead of overwriting it? Or
will I need to have each line make it's own file (outlook1.reg, outlook2.reg)
which is what I'm doing now...
This batch using a subroutine is extendable.
:RegExport file key Reset

If you append reset the file is recreated, otherwise the output
except the first lin eis appended.

::RegExport.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off&setlocal
set "_tmp=%~dpn0.tmp"
set "file=D:\Docs\Exchange\outlook.reg"

set "hive=HKEY_CURRENT_USER"
set "key=Software\Microsoft\Windows NT\CurrentVersion\"
set "key=%key%Windows Messaging Subsystem\Profiles"
Call :RegExport "%file%" "%hive%\%key%" Reset

set "key=Software\Microsoft\Exchange"
Call :RegExport "%file%" "%hive%\%key%"

del /Q "%_tmp%" >NUL
goto :eof
:RegExport file key Reset
regedit /e "%_tmp%" %2
if errorlevel 1 exit /B %errorlevel%
if /I %3. EQU Reset. (more %_tmp%" >%1) else (more +1 "%_tmp%" >>%1)
::RegExport.cmd::::::::::::::::::::::::::::::::::::::::::::::::::::::

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top