fizban2 Posted December 28, 2006 Posted December 28, 2006 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?
LeveL Posted December 28, 2006 Posted December 28, 2006 (edited) This will export the file "Exported.reg" to your C drive, it is thecorrect 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 December 28, 2006 by LeveL
Yzöwl Posted December 28, 2006 Posted December 28, 2006 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 methodREGEDITsBackupFile = "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, TrueREG.EXEsBackupFile = "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 beREGEDIT /E C:\Exported.regnotREGEDIT /E C:/Exported.reg</Edit>
fizban2 Posted December 28, 2006 Author Posted December 28, 2006 ahh thanks for bringing me back to reality, whenever i code i try and make things to hard :-D
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now