fizban2 Posted December 28, 2006 Share 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? Link to comment Share on other sites More sharing options...
LeveL Posted December 28, 2006 Share 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 Link to comment Share on other sites More sharing options...
Yzöwl Posted December 28, 2006 Share 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> Link to comment Share on other sites More sharing options...
fizban2 Posted December 28, 2006 Author Share Posted December 28, 2006 ahh thanks for bringing me back to reality, whenever i code i try and make things to hard :-D Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now