akm2 has asked for the wisdom of the Perl Monks concerning the following question:

I need to modify the value of HKEY_CURRENT_USER\Software\Microsoft\WAB\WAB4\Wab File Name in my WinXP PRO registry. I have written the following script:

$key = 'HKEY_CURRENT_USER\Software\Microsoft\WAB\WAB4\Wab'; #use Win32::TieRegistry; use Win32::TieRegistry ( Delimiter=>"/" ); $wabPath = $Registry->{$key};

The above code seems to get the current value of the key and store it in $wabPath exactly as desired. However, I can't seem to figure how to change the key value in the registry.

Any pointers?

Andrew Kenton Mitchell
Andrew@AndrewKMitchell.com

Replies are listed 'Best First'.
Re: Changing Registry Values
by Dog and Pony (Priest) on Jul 31, 2002 at 14:09 UTC
    I think this would work?
    $Registry->{$key} = $newWabPath;

    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.
Re: Changing Registry Values
by BronzeWing (Monk) on Jul 31, 2002 at 16:31 UTC
    According to the man page for Win32::TieRegistry (here), you should be able to do something as simple as this:

    $Registry->{$key} = 'foo';

    You might want to check your rights to that key too, since you're running under Windows XP. Also, try using 'CUser' instead of 'HKEY_CURRENT_USER' for the root key, there's something in the man page about that too.

    The Secret to Fortune Cookies in One Line
    print join("... in bed", `fortune fortunes` =~ m/^(.*)(\.|\?|\!)$/), "\n";