Ami
Ami

Reputation: 4259

How to select install directoy based on operating system in NSIS?

I have created EXE using nsis script.currently I have set the install directory this path

InstallDir "$PROGRAMFILES\myapp.

I have run exe file in windows xp,windows 7 32 bit and win7 64 bit. Installation directory may change xp and window 7.

How to find if the os is window 7 or window xp?

How to select installation directory based on os?

Upvotes: 2

Views: 801

Answers (1)

Anders
Anders

Reputation: 101666

Selecting the destination based on the OS is not usually something you should do but if you really want to you can use WinVer.nsh:

!include WinVer.nsh

Function .onInit
${If} ${AtLeastWinVista}
  StrCpy $InstDir "c:\VistaAndLater"
${Else}
  StrCpy $InstDir "c:\Win95To2003"
${EndIf} 
FunctionEnd

If you want to change it based on x86 vs AMD64, use x64.nsh

Upvotes: 3

Related Questions