Archive: How to select installation Directory based on OS?


How to select installation Directory based on OS?
By default installation directory I gave this

InstallDir "$PROGRAMFILES\myapplication"


When am i install win 7 64 bit exe installed in C:\Program Files (x86)\myapp instead of C:\program File\myapp.

Same way running win 7 32 bit exe installed in C:\program Files\myapp instead of C:\program Files(x86)\myapp.

I dont know why this variations happening?

Expected result:

win 7 64 bit C:\program Files\myapp

win 7 32 bit C:\program Files (X86)\myapp

I know if we checking some conditions we can change the directory.but why this variations happened?
I hope NSIS default behaviour is based on os it will select the installation directory.


On 64bit OS the $PROGRAMFILES and $PROGRAMFILES32 constant is mapped to C:\Program Files (x86)\ while $PROGRAMFILES64 points to C:\Program Files

On 32 bit OS the $PROGRAMFILES constant is mapped to C:\Program Files\.

So using $PROGRAMFILES on 32/64bit will give you various paths.


Originally posted by ilaiyaraja
When am i install win 7 64 bit exe installed in C:\Program Files (x86)\myapp instead of C:\program File\myapp.
NSIS is a 32 bits application, so its $PROGRAMFILES variable will always point to the 32 bits program files folder. On x64 windows, that directory is called "Program Files (x84)". If you want to install a 64 bits application, install it to $PROGRAMFILES64.

Originally posted by ilaiyaraja
Same way running win 7 32 bit exe installed in C:\program Files\myapp instead of C:\program Files(x86)\myapp.
On 32 bits windows, there is no "Program Files(x86)" directory. There is only Program Files.

Thanks MSG.got it Understood the behaviour of NSIS.


Edit: nvm


Originally posted by MSG
NSIS is a 32 bits application, so its $PROGRAMFILES variable will always point to the 32 bits program files folder. On x64 windows, that directory is called "Program Files (x84)". If you want to install a 64 bits application, install it to $PROGRAMFILES64.
Here I suppose you mean x64, there is no such directory as "Program Files (x84)" :D

Originally posted by T.Slappy
Here I suppose you mean x64, there is no such directory as "Program Files (x84)" :D
Actually I meant x86. :rolleyes: