View Full Version : How Can Make Backup From Registery To Text File?
Soheyl
02-09-2006, 08:24 AM
Hi;
I need make a backup from registery "HKCU, "Software\MyProduct\List" with all subdirectory (keys). But i don't know.
thanks.
Example:
key_name = Registry.GetKeyNames(2, "Software\\MyProduct\\List");
TextFile.WriteFromString(_DesktopFolder .. "\\Backup.txt", key_name, false);
Daniel TM
02-09-2006, 01:07 PM
Try this
result = Registry.GetKeyNames(HKEY_CURRENT_USER, "Software\\MyProduct\\List");
TextFile.WriteFromString("".._DesktopFolder.."\\Backup.txt", result[1], false);
That code gets the key names from HKEY_CURRENT_USER\Software\MyProduct\List and saves the first key name to a text file.
Soheyl
02-09-2006, 02:33 PM
Dear Daniel TM;
thanks;
:yes
Daniel TM
02-09-2006, 03:20 PM
No problemo. :)
Soheyl
02-16-2006, 08:42 PM
Dear Daniel TM;
thanks, but it is not work!
i tray it but this can only write on text file a subfolder !
example:
I want make a backup from this path with all subfolders and contains:
HKEY Current User\Software\MyProduct
Subfolders is:
1
1
3
4
your code just make backup from 1 subfolder without contains...
tnx.
Eagle
02-16-2006, 08:55 PM
try something like this:
tkeynames = Registry.GetKeyNames(HKEY_CURRENT_USER, "Software\\MyProduct\\List\\");
if tkeynames then
for n , key in tkeynames do
TextFile.WriteFromString("".._DesktopFolder.."\\Backup.txt", key, true); --append
end
end
as another option: at a command prompt type reg.exe export /?
this allows you to export to a file the entrie tree based on your
registry source start key
you could write the commands to batch file and run it using
File.Run(_SystemFolder.."\\reg.exe", commands, "", true) --wait till done
another option is using the registry actions to create a table-s of the
registry structure-key paths you wish to return the information to.
with a bit of work you can add functionality to the table-s to return
specfic data etc for each key etc.,append each line of a table to a text file perhaps.
hth a little
Eagle
02-16-2006, 09:12 PM
you would need to extend the above table example to include similar
to cycle any subkeys etc for each main key as required
(above table example only returns the keyname- no full path stuff)
btw:
TextFile.WriteFromString(_DesktopFolder.."\\Backup.txt", key, true); --append
Soheyl
02-16-2006, 10:12 PM
Thanks Eagle; thanks...
But i also want all cantains write to a text file;
example:
[HKEY_CURRENT_USER\Software\MyProduct]
"MyFolder"="C:\\Documents and Settings\\User\\Application Data\\MyApplication\\"
"Servers"="*.update.microsoft.com download.windowsupdate.com"
I want write to a text file this path with that:
Backup.txt
MyFolder=C:\\Documents and Settings\\User\\Application Data\\MyApplication\\
Servers=*.update.microsoft.com download.windowsupdate.com
again big thanks for your help...
Soheyl
02-16-2006, 10:41 PM
I found it...
I now can make backup and write to text file...
thanks,
I now have a new problem with Type Key, I can write any type key to text file but can't write key with type "REG_NONE" !
AMS have Registry.GetType, can i set a Type for Value ?
I need Registry.SetType for write this key's to text file...
how can? tnx :cool
Eagle
02-16-2006, 10:49 PM
Have a try at using the: tregvlnms = registry.getvaluenames(fullpath.."\\"..key) action
to cycle each key path in your main table
for n, value in tregvlnms do
textfile.write....-append to your existing .txt
you'll need to do a bit more to write to the text file
all that you want in the format that you want.
Eagle
02-16-2006, 11:06 PM
maybe ..try the the reg type stuff as you mentioned..sounds like you
just about got it :yes
Soheyl
02-16-2006, 11:10 PM
Dear Eagle; AMS don't have Registry.SetType !
please if may show this code.
Eagle
02-16-2006, 11:17 PM
no code..from memory you have to write the registry value in the
same format as the reg.gettype format..using string manipulation
have a look here:
http://www.indigorose.com/forums/showthread.php?t=9535&highlight=disable+autorun
may help you with format to write
Soheyl
02-16-2006, 11:27 PM
I think AMS can't write normally a key with type REG_NONE to text file...
I try it... thanks... :yes
Eagle
02-16-2006, 11:42 PM
glad to be of some assistance at least :cool
Soheyl
02-21-2006, 12:09 AM
I really tired... :rolleyes
I can't find it...
Anyone please if may insert a example for this work.
Make a backup from registry with value from type REZ_NONE
please, please :rolleyes :huh :rolleyes :huh
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.