Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use innosetup script to delete previously installed application folder

Tags:

inno-setup

I am deleting the previous application using the script which inturn calls my .net app. All i want is to actually delete the folder(entire app1) from start menu (start->Programs->app1->uninstall app1)?

Thanks Gauls

like image 867
Gauls Avatar asked Mar 17 '10 15:03

Gauls


3 Answers

If you just want to delete the "uninstall app1" icon from the Start menu, the following should work:

[InstallDelete]
Type: files; Name: "{group}\uninstall app1"

If you want to remove the entire program group from the start menu, use the following:

[InstallDelete]
Type: filesandordirs; Name: "{group}"

This assumes that your Inno Setup script Start menu folder name is the same as the previous "app1" application.

like image 129
Craig Lebakken Avatar answered Nov 06 '22 08:11

Craig Lebakken


None of those worked for me, after work-around, here is my solution; in [Setup]

//Delete old entry folder from start menu
procedure DeleteOldStartMenuEntry;
var
 entry: String;
begin
 //Replace "Diviner" with desired folder name 
 entry := ExpandConstant('{commonprograms}') + '\Diviner\';
 if DirExists(entry) then begin
   DelTree(entry, true, true, true);
  end 
end;

Inside InitializeSetup call your procedure :

function InitializeSetup: Boolean;
var:
    ....
begin
    ....
    DeleteOldStartMenuEntry;
    ....
end;
like image 23
Roman Polen. Avatar answered Nov 06 '22 09:11

Roman Polen.


Thanks Craig my new app doesn't have the same name (app2) following worked for me

[InstallDelete]
Type: filesandordirs; Name: {commonprograms}\app1 
like image 2
Gauls Avatar answered Nov 06 '22 07:11

Gauls