Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup: How to get current user directory when running installer as admin?

I need to write a ini file to the current user's directory in Windows 7 (C:\Users\CurUser). CurUser is not an admin. My installer requires admin privileges. So my setup looks like this:

[Setup]
PrivilegesRequired=admin

When I run the installer it prompts for the admin to login. From that point on, all the user constants, userappdata, etc, are C:\Users\AdminUser... So I need a way to find the CurUser when running the install as AdminUser.

Code examples are appreciated. Thanks.

like image 413
PM2 Avatar asked Jun 15 '11 13:06

PM2


People also ask

How do I use Inno installer?

Go to Menu, Project, then Compile to compile and create the setup file. This will create a complete installer. Run the Setup and your application will be installed correctly. Innosetup offers an awesome alternative to create great looking Installers for free.

How do I create a folder in Inno?

I use example script of inno download. [Code] //HERE I NEED TO CREATE FOLDER "Downloaded" procedure InitializeWizard(); begin itd_init; itd_addfile('http://link.net/soft/file.exe',expandconstant('{sd}\Downloaded\file.exe')); itd_downloadafter(wpReady); end; inno-setup.

Is Inno Setup open source?

Inno Setup grew popular due to being free and open source; free for both commercial and non-commercial use, many software companies switched to the tool.

What does Inno Setup do?

Creation of shortcuts anywhere, including in the Start Menu and on the desktop. Creation of registry and . INI entries. Running other programs before, during or after install.


2 Answers

All user specific files/settings that the app requires should be written by the app if they are found not to exist. If it needs to come from the setup, you can write it into a global location as a "default" for the app to copy or use.

This also means your app will work for ALL users on the system rather than just the user that ran the setup.

like image 95
Deanna Avatar answered Oct 11 '22 05:10

Deanna


You should split your setup into two parts. The first non-admin part writes the ini file to the current user directory and it calls the second setup part which requires admin priviliges.

like image 44
splash Avatar answered Oct 11 '22 04:10

splash