Page 1 of 1

Program Files direcory localisation

Posted: Tue Mar 11, 2014 9:33 am
by Ton_B
I've created a generic setup which can be started with a command line.
This command line contacins the setup location lik "Program files"

Inside my script i detect if the current OS is 32 or 64 bits and alter the location to "Program Files(x86)" if the system is 64 bits.

But because in some countries this path do not have "program files" I would like to get the default "program files" directory name oth the current county.

See:
http://en.wikipedia.org/wiki/Program_Files

in .NET you can retreive it with this code: http://stackoverflow.com/questions/194157/c-sharp-how-to-get-program-files-x86-on-windows-vista-64-bit
in vb6 you can make an api call like this : http://www.developerfusion.com/code/251/special-folder-paths/

The question is, does IA has a similar function? or do i have to make a api call?

Re: Program Files direcory localisation

Posted: Tue Mar 11, 2014 1:23 pm
by FrancescoT
Dear Ton,

The IA command "Get Folder Location" does exactly when used to acquire the "System->Program Files".

If you need to dected the target Program Files directory based on the target OS platform, just call the "Get Folder Location" after a Set x64 statement.

Example;

Code: Select all

Set Variable ISWIN64 to FALSE
Get System Setting Windows in 64 bit Mode into ISWIN64
if Variable ISWIN64 Equals TRUE
  Comment: SWITCH TO NATIVE 64 BIT MODE
  Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
end
 
Get Folder Location System->Program Files Directory into PROGRAMFILES
 
if Variable ISWIN64 Equals TRUE
  Comment: SWITCH BACK TO NATIVE 32 BIT MODE ... IF YOU ARE INSTALLING A NATIVE 32 BIT APP!
  Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
end


Hope this helps you.

Regards

Re: Program Files direcory localisation

Posted: Thu Mar 13, 2014 1:15 am
by Ton_B
Hello Francesco.

Yhank you very much!
Your sample code is exactly what I need, including the "swich back to 32 bit" !

Re: Program Files direcory localisation

Posted: Thu Mar 13, 2014 9:16 am
by FrancescoT
:D