Jump to content

Recommended Posts

Posted

Ok,

trying to find an easier way to do this,

i want to export a whole subset of registry keys.

particulary [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers]

but all i can find through vb or wmi is how to read one key at a time, which is alot of keys with multiple types of keys. any ideas on a good way to accomplish this?


Posted (edited)

This will export the file "Exported.reg" to your C drive, it is the

correct registry path for what you want exported...

REGEDIT /E C:/Exported.reg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers"

Simply put it in a .BAT or .CMD file and run from anywhere.

REGEDIT - runs regedit.exe

/E - Tells it to "export".

C:/Exported.reg - Name of your registry file that will be exported

"HKLM/../../../../.." - Registry key to be exported.

Edited by LeveL
Posted

You can use either regedit, as already suggested or if installed reg.exe.

The latter would definitely be better if ran from a vbscript, so here are both examples using that scripting method

REGEDIT

sBackupFile = "X:\KeyBkUp.reg"
sRegPath = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers"
sCmd = "REGEDIT /E """ & sBackupFile & """ " & """" & sRegPath & """"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCmd, 0, True

REG.EXE

sBackupFile = "X:\KeyBkUp.reg"
sRegPath = "HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers"
sCmd = "%COMSPEC% /C REG EXPORT """ & sRegPath & """ " & """" &_
sBackupFile & """"
Set oShell = CreateObject("WScript.Shell")
oShell.Run sCmd, 0, True

<Edit>

BTW LeveL it should be

REGEDIT /E C:\Exported.reg

not

REGEDIT /E C:/Exported.reg

</Edit>

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...