Next Generation Emulation banner

Regedit help

1177 Views 5 Replies 3 Participants Last post by  Janus
hey tryin to export the whole registry into a file using command line
i can do it for the individual branches but i cant seem to export the whole registry into one file?

Anyone knows how to do this? thanks
1 - 2 of 6 Posts
AFAIK it's:

regedit /E "c:\name of folder \nameof file.reg" HKEY_USERS

please note:

a) the quotes are required around the reg file
b) the registry is a hirarchical structure (very like linux's hfs, if I didn't know any better I say m$ based the registry on it :p). You only need to backup HKEY_USERS. All other root keys are actually soft links to keys within HKU.
c) Caps are necessary (not 100% sure about that, but why take the risk ;) )
Oops, I used the new posts option and didn't notice the forum;)

Ok the easy way: just spawn regedit from above via ShellExecute() or ShellExecuteEx(). Here's my code for doing that (written in c++)

//backs up the specified keyName into regfile, in currentFolderPath
backupReg(CString keyName,CString regFile,CString currentFolderPath)
	CString commandLine;
	commandLine ="/E \""+  regFile +"\" " + keyName;
	ZeroMemory( &sei, sizeof(sei) );

		MessageBox(NULL,"Unable to backup " + keyName + " settings","Error",MB_OK|MB_ICONERROR);
		return -1;
		WaitForSingleObject( sei.hProcess, INFINITE );
	return 0;
If you set keyName = "" it will backup everything, or set it to a specific branch for a partial backup. The trick to making this work is the WaitForSingleObject() function. This effectively pauses your apps execution until regedit has exited, meaning that the backup will have been flushed to disk before the function finishes (in order to prevent any potential problems).
See less See more
1 - 2 of 6 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.