Remove folder specified by user at install time in Inno Setup Uninstaller - inno-setup

I have a setup script which allows the user to specify a relative path where the application will save some files and folders. The path will be saved to a config.ini file. Till then everything works as expected.
Now I want the uninstaller to perform a removing of all content under the specified path. In my installer script I have a variable
var DataPath : String;
which holds the path.
To perform the removing I added the following lines of code (as mentioned on their website) to my script:
[UninstallDelete]
Type: filesandordirs; Name: DataPath
Unfortunately this doesn't work. Does anyone know how to do this?
My [INI] sections look like the following:
[INI]
Filename: "{app}\config.ini"; Section: "connection = standard"; \
Key: datapath; String: {code:GetDataPath}

Use {code:GetDataPath} in the [UninstallDelete], the same way you use it in the [INI] section:
[UninstallDelete]
Type: filesandordirs; Name: {code:GetDataPath}

Related

How to generate a URL Link on the desktop in Inno Setup

I am looking for the option to create a URL link with Inno Setup on the desktop.
I need to call my web application with some parameters. Till now I was only able to create a shortcut to my application folder an my program, but how to create a URL link?
I think it must be solved in the Icons section?
[Icons]
Name: "{group}\MyAPP"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"
Name: "{group}\App Logs"; Filename:"{commonappdata}\Foo\App\logfiles"; \
WorkingDir: "{commonappdata}\Foo\App\logfiles"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
Just set the Filename parameter to the URL:
Filename (Required)
...
In addition to file and folder names, URLs (web site addresses) may also be specified. When a URL is specified, Setup will create an "Internet Shortcut" (.url) file, and ignore the Parameters, WorkingDir, HotKey, and Comment parameters.
Example:
[Icons]
Name: "{autodesktop}\Web"; Filename: "https://www.example.com/"
Internet shortcuts must be specified in INI section
[INI]
FileName={commondesktop}\MyShortcutName.url,Section:InternetShortcut;Key:URL;String: Http://MyShortcutName.com

Startup folder shortcut not created

Here's part of my inno setup script:
[Setup]
PrivilegesRequired=admin
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
When i open the startup folder Win+R and type "shell:startup", there is no such folder created after the setup completed. The normal Program folder is created though. As I understand, to modify commonstartup, requires admin privilege and I have added this entry in Setup, but still not working. Anybody have any idea why and how to fix this?
EDIT: ok i tried with {userstartup} then it works. so my question is why the commonstartup one can't work?
The shell:startup opens user's "startup" folder, not the common one.
To open the common one, use shell:common startup.

Inno Setup "Wrong Parameter" (Wusa.exe and .msu)

I am trying to create a Setup using Inno Setup. Because I have to install a .msu file, I use the Wusa.exe.
The important code line:
Filename: {sys}\wusa.exe; WorkingDir: {app}; Parameters: {app}\Windows6.1-KB2506143-x64.msu;
Every time I launch the program, it gives me this error and I couldn't figure out a solution yet:
2147942487 "Wrong Parameter."(Commandline:""C:\Windows\system32\wusa.exe" C:\Program Files (x86)\Phone-O-Mat\Windows6.1-KB2506143-x64.msu")
You are missing quotes around the file name. You need these, as the {app} resolves to a path with spaces:
Filename: {sys}\wusa.exe; WorkingDir: {app}; \
Parameters: """{app}\Windows6.1-KB2506143-x64.msu"""

Inno Setup is not including any of indicated files in destination folder

This is the first time I've used an installer program other than Access Developer Extensions. I have couple of MS Access files I'm trying to have installed into the user's AppData\Local folder. The only thing it will seem to do is put two files in that folder: unins000.exe and unins000.dat. It seems to ignore the files I want put in there, although when I compile it's definitely including them in the Setup.exe file. Here is the script - can someone tell me what could be wrong here? It doesn't seem to matter if the destination folder or files exist or not - I get the same result.
; -- LEAP.iss --
[Setup]
AppName=LEAP
AppVersion=1.1
DefaultDirName={localappdata}\LEAP
DefaultGroupName=LEAP
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Output
[Files]
Source: "China.accdb"; DestDir: "{localappdata}"; DestName: "China.accdr"
Source: "Replica of China_be.mdb"; DestDir: "{localappdata}"
[Icons]
Name: "{group}\LEAP"; Filename: "{localappdata}\China.accdr"
Name: "{userdesktop}\LEAP"; Filename: "{localappdata}\China.accdr"
You want to replace {localappdata} with {app} in the [Files] and [Icons] sections. The {app} constant is defined once the user selects the install location on the "Select Destination Location" wizard page. Your end-users might not appreciate that you've allow them to choose a location to install your program, only to find out that you've actually hard-coded that location in the installer.
If you don't want them to choose a location, then set DisableDirPage=true in [Setup].
You should also establish an AppID value in [Setup].

Use innosetup script to delete previously installed application folder

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
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.
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;
Thanks Craig my new app doesn't have the same name (app2) following worked for me
[InstallDelete]
Type: filesandordirs; Name: {commonprograms}\app1

Resources