By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

Updating Data field of Value in Registry

P: n/a
LCD
Here is what I want to do:

Presently in my registry I have:

(Default) = "C:\Program Files\myApp" and this value is scattered all over
registry in several keys and subkeys.

I wouldlike to have write a small c# app that will search the Data file
"C:\Program Files\myApp" and replace it with "E:\Data\myApp". In regedit one
can search for a certain data, but you can't do "Replace All" with a certain
data type, hence this quest for writing and learning to interact with
Registry.

I have written apps in the past to read specific registry values, but
nothing generic of this nature. Can someone point me and advise me on how to
do this. Any and all help is greatly appreciated.

Regards, LCD
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
LCD,

This is a function you will have to perform manually. Unless you are
writing a general-purpose app to do this, I wouldn't recommend doing this.
It is possible that there are other registry keys in your system that have
this value in it which should not be replaced.

If you wanted to do this, you would basically have to iterate through
all of the keys recursively (your implementation shouldn't be recursive, but
the operation is a recursive one, to say the least). You would open the
registry key for the root nodes (maybe not all of them, because some of them
are really references to nodes in other trees), and check to replace your
value (through a call to GetValueNames and GetValue).

Then, you would call GetSubKeyNames to get the names of all the sub keys
of the current registry key, and perform the same operation on them.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"LCD" <LC*@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
Here is what I want to do:

Presently in my registry I have:

(Default) = "C:\Program Files\myApp" and this value is scattered all over
registry in several keys and subkeys.

I wouldlike to have write a small c# app that will search the Data file
"C:\Program Files\myApp" and replace it with "E:\Data\myApp". In regedit
one
can search for a certain data, but you can't do "Replace All" with a
certain
data type, hence this quest for writing and learning to interact with
Registry.

I have written apps in the past to read specific registry values, but
nothing generic of this nature. Can someone point me and advise me on how
to
do this. Any and all help is greatly appreciated.

Regards, LCD

Nov 17 '05 #2

P: n/a
On Nov 10th Willy Denoyette [MVP] referred to a Microsoft Tool called
LogParser in a posting labeled "Search for a registry key with a certain
value" which may help you.

Google for it....
Dave
"LCD" <LC*@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
Here is what I want to do:

Presently in my registry I have:

(Default) = "C:\Program Files\myApp" and this value is scattered all over
registry in several keys and subkeys.

I wouldlike to have write a small c# app that will search the Data file
"C:\Program Files\myApp" and replace it with "E:\Data\myApp". In regedit
one
can search for a certain data, but you can't do "Replace All" with a
certain
data type, hence this quest for writing and learning to interact with
Registry.

I have written apps in the past to read specific registry values, but
nothing generic of this nature. Can someone point me and advise me on how
to
do this. Any and all help is greatly appreciated.

Regards, LCD

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.