in reply to Re: Getting Windows control panel to invoke an uninstall script
in thread Getting Windows control panel to invoke an uninstall script

Good tip. Thanks. I was able to use Win32::TieRegistry to
implement it. I ran a couple of "proof of concept" tests. It works okay
To save others some leg work, here is the code I will be implementing in my installer (Windows ME version):

use Win32::TieRegistry;
my $uninstall_path =
"LMachine\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
my $uninstall_bat =
"c:\\Windows\\Profiles\\$loginname\\My\ Documents\\uninstall.bat";

$key = new Win32::TieRegistry "$uninstall_path";
$prog_key = $key->CreateKey( "$my_program_name");

$prog_key->SetValue( "DisplayName", "$my_program_name" );
$prog_key->SetValue( "UninstallString", "$uninstall_bat" );


##########################
Here is the I will be implementing in my uninstaller (Windows ME version). That is, somewhere in the
uninstall.bat defined for UninstallString, after all the other uninstall work has been done

use Win32::TieRegistry;

my $uninstall_key_path =
"LMachine\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
my $key = new Win32::TieRegistry "$uninstall_key_path";
delete $key->{"\\$my_program_name"};
undef $key;
  • Comment on Re^2: Getting Windows control panel to invoke an uninstall script

Replies are listed 'Best First'.
Re^3: Getting Windows control panel to invoke an uninstall script (anon hash assign)
by tye (Sage) on Dec 19, 2004 at 00:51 UTC

    I'd write that more like:

    my $Reg; use Win32::TieRegistry( TiedRef => $Reg, Delimiter => '/' ); $Reg->{ "LMachine/Software/Microsoft/Windows/" . "CurrentVersion/Uninstall/$name/"} = { DisplayName => $name, UninstallString => $uninstallPath, } or die "Can't load registry: $^E";

    But there are a lot of ways to use that module.

    - tye