How to VBS read and write a registry VALUE that is a file path

I'm using VBS to do a recursive search and replace through:

HKCU\Software\Title

... that enumerates all SubKeys, SubKeys of Subkeys etc, all VALUES within, then finding/replacing a string of text in the DATA of lucky Values.

The problem lies in when a Value Name is a path.

An example export:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Level01]
"StringValue"="abc"
"c:\\folder\\folder\\folder"="def"

[HKEY_CURRENT_USER\SOFTWARE\Level01\Level02]
"StringValue"="abc"

While in regedit, the bolded text visually appears as a VALUE of c:\folder\folder\folder with DATA of def .  When regedit exports that key, the \ doubles up.

Using VBS to enumerate, the resulting path spits out as:

HKEY_CURRENT_USER\SOFTWARE\Level01\c:\folder\folder\folder

... this is all kinds of wrong and trips the script into not reading, and subsequently not being able to write because of course there is no key path HKEY_CURRENT_USER\SOFTWARE\Level01\c:\folder\folder\folder

How can I fix reading and writing this badly named Value?

The solution must be a VBS script because it is running as either a logon script or launching script by limited and mandatory profile users, to dynamically rewrite DATA to user-specific paths.

I repeat, I'm not changing the VALUE NAME, I want to change the DATA associated with it; the ="def".

September 11th, 2015 1:50am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics