[?]save a registry key

S

sen

How can I save a registry key(key, subkeys, and all values) and then save as
a reg file. The same way U would normally do a Reg export.
 
M

Mark V

In said:
How can I save a registry key(key, subkeys, and all values) and
then save as a reg file. The same way U would normally do a Reg
export.

Do you mean the "Save key..." / "Restore..." functions in regedt32.exe?

Save as a binary file including permissions. This is distinctly
different that Export/Import functions. Read up and understand it in
advance. Full registry backups in advance.
 
D

Dean Wells [MVP]

sen said:
How can I save a registry key(key, subkeys, and all values) and then
save as a reg file. The same way U would normally do a Reg export.

Hopefully this is what you're after -

Use regedit.exe:
REGEDIT /E filename [regpath]
REGEDIT /E:A filename [regpath]
REGEDIT /A filename [regpath]

/E filename
Specifies the file to export the registry to.

/E:A and /A
Specifies ASCII output for W2k/WXP (default Unicode)

HTH
 
S

sen

Dean -

When using the sample U provided I get no errors nor can i find any info
from within the command window about "regedit" and the switchs u are using.
Next i am still unable to "save the key as a reg file" and to a specified
"location". Is there no way to do this from a batch file and surpress
regedit32 from poping up when I run this batch file?

This is a sample of the bat I plan to have taskmanager run.
----------------------bat----------------------------------
ECHO OFF
CLS
TITLE BACKUP - Regkeys
ECHO BackUp Defined Regkeys.
REGEDIT /E:A tester1 [HKEY_CURRENT_USER\Software\Microsoft\Internet Account
Manager]
PAUSE
---------------------end bat------------------------------

: sen wrote:
: > How can I save a registry key(key, subkeys, and all values) and then
: > save as a reg file. The same way U would normally do a Reg export.
:
: Hopefully this is what you're after -
:
: Use regedit.exe:
: REGEDIT /E filename [regpath]
: REGEDIT /E:A filename [regpath]
: REGEDIT /A filename [regpath]
:
: /E filename
: Specifies the file to export the registry to.
:
: /E:A and /A
: Specifies ASCII output for W2k/WXP (default Unicode)
:
: HTH
:
: --
: Dean Wells [MVP / Windows platform]
: MSEtechnology
: [[ Please respond to the Newsgroup only regarding posts ]]
: R e m o v e t h e m a s k t o s e n d e m a i l
:
:
 
T

Torgeir Bakken \(MVP\)

sen said:
Dean -

When using the sample U provided I get no errors nor can i find any info
from within the command window about "regedit" and the switchs u are using.
Next i am still unable to "save the key as a reg file" and to a specified
"location". Is there no way to do this from a batch file and surpress
regedit32 from poping up when I run this batch file?

This is a sample of the bat I plan to have taskmanager run.
----------------------bat----------------------------------
ECHO OFF
CLS
TITLE BACKUP - Regkeys
ECHO BackUp Defined Regkeys.
REGEDIT /E:A tester1 [HKEY_CURRENT_USER\Software\Microsoft\Internet Account
Manager]
Hi

Use /S for silent, and also add quotes around the file path and
registry key path, like this:

REGEDIT.exe /S /E:A "c:\my files\tester1" "[HKEY_CURRENT_USER\
Software\Microsoft\Internet Account Manager]"
 
P

Paul R. Sadowski

Torgeir Bakken (MVP) said:
REGEDIT.exe /S /E:A "c:\my files\tester1" "[HKEY_CURRENT_USER\
Software\Microsoft\Internet Account Manager]"

No brackets around the key. It won't work that way.

REGEDIT.exe /S /E:A "c:\my files\tester1" "HKEY_CURRENT_USER\
Software\Microsoft\Internet Account Manager"
 
S

sen

@ Paul & Torgeir - everything is working perfectlly thanks.

Is there some where that I can find more info on commands not listed when
using help. The "regedit" like I meantioned before is not documented any
where and Im just wondering what other cmd prompts I dont know about.
 
S

sen

@ Paul & Torgeir - everything is working perfectlly thanks.

How can I write multiple keys to one file and insert a breaker showing where
I started recording the next key.

EX. of output file format:

[KEY]
;---------------line break----------------------------
[next KEY] and so on

Is there some where that I can find more info on commands not listed when
using help. The "regedit" like I meantioned before is not documented any
where and Im just wondering what other cmd prompts I dont know about.
 
D

Dean Wells [MVP]

sen said:
@ Paul & Torgeir - everything is working perfectlly thanks.

How can I write multiple keys to one file and insert a breaker
showing where I started recording the next key.

EX. of output file format:

[KEY]
;---------------line break----------------------------
[next KEY] and so on

Is there some where that I can find more info on commands not listed
when using help. The "regedit" like I meantioned before is not
documented any where and Im just wondering what other cmd prompts I
dont know about.

I'm afraid you can't do that directly. It is, however, relatively easy
to concatenate two exported files together. For example -

[Script]
:: Export first key
REGEDIT /S /E:A "%TEMP%\REG1.tmp"
"HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager"

:: Export 2nd key
REGEDIT.exe /S /E:A "%TEMP%\REG2.tmp"
"HKEY_CURRENT_USER\Software\Microsoft\Clock"

:: Append break string and blank line to first exported key
echo --------- BREAK --------->>"%TEMP%\REG1.tmp"
echo/ >>"%TEMP%\REG1.tmp"

:: Concatenate the two exported keys
copy "%TEMP%\REG1.tmp"+"%TEMP%\REG2.tmp" C:\REGdone.DAT

:: Clean up the temporary files
del "%TEMP%\REG1.tmp" "%TEMP%\REG2.tmp"
[/Script]

Copy and paste the script above (excluding the two [Script] lines) into
a batch file and modify accordingly. Note, each of the REGEDIT lines
above will likely appear as two lines and should be recombined after the
paste.

HTH
 
S

sen

Dean - Thx very much I am plzed at how it works.

Thx to all others who helped as well.

I am curious thought if it is possible to remove or prevent the " REGEDIT4"
from appearing after it has already been written to the final output file.
This would help save time if I ever need to restore these keys later on.
 
J

Jerold Schulman

Dean - Thx very much I am plzed at how it works.

Thx to all others who helped as well.

I am curious thought if it is possible to remove or prevent the " REGEDIT4"
from appearing after it has already been written to the final output file.
This would help save time if I ever need to restore these keys later on.

If you final file with all the REGEDIT4 statements is file1.reg, then:

@echo REGEDIT4>file2.reg
findstr /B /V "REGEDIT4" file1.reg>>file2.reg

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
G

guard

Is there some where that I can find more info on commands not listed when
using help. The "regedit" like I meantioned before is not documented any
where and Im just wondering what other cmd prompts I dont know about.

Try (http://TheSystemGuard.com/MasterCatalog.asp)

-tsg
____________________________________________________________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!
 

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

Similar Threads


Top