PDA

View Full Version : export .reg files to use them on rollback options


kk250040
10-29-2008, 06:27 AM
Hello Friends,

My installation sets or changes registry entries at various places on host. I can try doing a GetValue or GetValueNames to retrieve the registry values. But if I want to backup a whole .reg file, say HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.

Need help on taking backup of parts of registry tree to use them on an Uninstall.
Please help...

Ulrich
10-29-2008, 08:33 AM
But if I want to backup a whole .reg file, say HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.

See this example to export the hive to your temporary folder:


Shell.Execute("reg", "open", "EXPORT HKEY_LOCAL_MACHINE\\Software\\Microsoft " .. _TempFolder .. "\\registry_export.reg", "", SW_MINIMIZE);


Modify as necessary and check the command line options of REG (the Console Registry Tool for Windows) for further inspiration. Hope this helps.

Ulrich

kk250040
10-29-2008, 01:46 PM
I will try this thanq, Seems this would work.

kk250040
11-12-2008, 02:41 AM
Hello Friends,

I was stuck with many other tasks that I couldnot comeback on this till now. Now its important for me to complete, so please help.

I have tried the following action on a StartUp of an installation, but the desktop folder did not contain the .reg file. Please let me know what i can do to correct this. :huh


Shell.Execute("regedit", "open", "EXPORT HKEY_LOCAL_MACHINE\\Software\\Microsoft " .. _DesktopFolder .. "\\registry_export.reg", "", SW_MINIMIZE);


Thanks in advance!

kk250040
12-05-2008, 06:42 AM
The best that i could do simply is to write a batch file for backing up my registry and folders/files. Posting the sample batch file script for people who might want to do a similar job...



@echo off
:: variables
set drive=G:\Backup
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up My Documents...
%backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Documents"

echo ### Backing up Favorites...
%backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites"

echo ### Backing up email and address book (Outlook Express)...
%backupcmd% "%USERPROFILE%\Application Data\Microsoft\Address Book" "%drive%\Address Book"
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Identities" "%drive%\Outlook Express"

echo ### Backing up email and contacts (MS Outlook)...
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" "%drive%\Outlook"

echo ### Backing up of a branch or part of Registry...
if not exist "%drive%\Registry" mkdir "%drive%\Registry"
if exist "%drive%\Registry\OracleRegbackup.reg" del "%drive%\Registry\OracleRegbackup.reg"
regedit /e "%drive%\Registry\OracleRegbackup.reg" "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE"

echo ### Backing up of whole Registry...
if not exist "%drive%\Registry" mkdir "%drive%\Registry"
if exist "%drive%\Registry\regbackup.reg" del "%drive%\Registry\regbackup.reg"
regedit /e "%drive%\Registry\regbackup.reg"

:: use below syntax to backup other directories...
:: %backupcmd% "...source directory..." "%drive%\...destination dir..."

echo Backup Complete!
@pause



The text file with this content can be saved with a .bat extension and its ready to take backup. This file can just be included in the setup and run for having a backup. I got the simliar work around in some web pages and thought to add such in the forum.