%username% variable issue - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

JohnTFish
Posts: 3
Joined: Tue May 22, 2007 8:09 pm

%username% variable issue

Hey everyone,

I am trying to setup a MSI by using %username% to specify the path. To be more specific this is the path i have set

Windows Volume\Documents and Settings\%username%\App

While this works correctly, it also creates the folder %username% which i do not want. If anyone has any info on this please let me know.

Thanks
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

The default installation folder is located in the "Install Parameters" page. So switch in that page and type following path in the "Application Folder" filed:
[WindowsVolume]Documents and Settings\[%USERNAME]\App

This will be translated to something like this:
C:\Documents and Settings\username\App\

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
JohnTFish
Posts: 3
Joined: Tue May 22, 2007 8:09 pm

I apologize, i was not very specific in what i was trying to do. Here is the thing, i am installing a program which needs to be in C:\Program Files\ProgramName, however configuration is based off the user so the settings are stored in C:\Documents and Settings\Username\ProgramName\Program Properties

I have the properties file that i want to use for the user so here is what I did

Under Files & Folders i added the following to Windows Volume

Documents and Settings\%Username%\ProgramName\Program Properties

This works great except for the fact that it also creates a folder called %username%

Is there anyway to prevent the folder creation?

Thanks
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

The user specific folder is AppDataFolder corresponding to "Application Data" folder from AI "Files and Folders" page.

So add your file into this folder and they will be copied in: "C:\Documents and Settings\username\Application Data". Where username is the name of the user how install the package.

If you want to install to all users folder use the "Common Application Data" folder.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
JohnTFish
Posts: 3
Joined: Tue May 22, 2007 8:09 pm

Unfortunately, that will not work. The file wont work in the appdata folder. It has to be in

C:\Documents and Settings\User\ProgramName\Program Properties

Like i said i can get it to work by putting the following path in the Windows Volume on the Files and Folders page

C:\Documents and Settings\%username%\ProgramName\Program Properties (The properties file contains the configuration)

However, this also creates a folder under C:\Documents and Settings called %username% which i dont want on 100+ machines.

Thanks
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Then create a property in the "Install Parameters" page and use it as a property based folder ("New Folder->Property Based") in the "Files and Folders" page.

Now create a "Property Set With Formatted" custom action under "InstallUISequence->Begin" and use following options:
Property Name: property name created above.
Formatted Text: [WindowsVolume]Documents and Settings\[%USERNAME]\ProgramName\Program Properties

Drag this custom action (while shift key is pressed) to "InstallExecuteSequence->Begin" standard action.

Add your files in the new created folder.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”