How to install files in the correct folder using Visual Installer

As described in this blog post, there exist two Program Files folders in a 64 bit computer with a 64 bit Windows. One folder is used as a storage place for 32 bit programs and the other folder is used as a storage place for 64 bit programs. And it is important that your program files are installed in the correct folder in a 64 bit system, otherwise there is a risk that your program will not function as expected.

Windows in different languages
If you create an application that may be installed in non-English versions of Windows it is important to know that the name of the Program Files folder may be different compared to the English version of Windows. For example in a Spanish version of Windows the name of the Program Files folder is Archivos de programa. In a Spanish 64 bit Windows, where 32 bit and 64 bit program files / binary files also must be placed in different folders, there will exist the following two folders on the user’s hard disk:

C:\Arquivos de Programas : For 64 bit files
C:\Arquivos de Programas (x86) : For 32 bit files

This can be compared with the folders in an English 64 bit Windows:

C:\Program Files : For 64 bit files
C:\Program Files (x86) : For 32 bit files

(more examples of localized folder names is available in this article on our web site.)

Use an environment variable
It is impossible to handle all of the above combinations by hard-coding the folder path to the Program Files folder. We also advise against any tries to do so. Instead you should use an environment variable in Visual Installer that has the name %PROGRAMFILES to handle this. By placing this variable in the beginning of a folder path, for example like this:

%PROGRAMFILES\SamLogic\Visual Installer

the %PROGRAMFILES variable will be changed to correct folder path, regardless of the bitness of the program files / Windows and regardless of the language of the Windows. This replacement will occur during the setup process in the user´s computer.

Easier to select a variable in Visual Installer 2012
In Visual Installer 2012 (version 9.5.15 or later) it is easier to select correct variable to the main folder of the setup project. We have added a button to the right of the Main folder text box:

If you click on this button (the button with three dots) the dialog box below will be opened:

Via this dialog box you can choose and include the %PROGRAMFILES variable, or another relevant variable, to the main folder of your installation project in an easy way.

Leave a Reply