AtLeastWin<version> 检测是否高于指定版本
IsWin<version> 检测指定版本(唯一限定版本)
AtMostWin<version> 检测是否低于指定版本
<version> 允许的值:
95、98、ME、NT4、2000、XP、2003、Vista、2008、7、2008R2
示例1:
name "使用头文件判断操作系统" outfile '使用头文件判断操作系统.exe' !include "MUI.nsh" !include "WinVer.nsh" !insertmacro MUI_LANGUAGE "simpchinese" Section SectionEnd Function .onInit ${If} ${AtLeastWinVista} MessageBox MB_OK "系统为 Vista 或 Vista 以上系统!" ${EndIf} ${If} ${IsWin2000} ${OrIf} ${IsWinXP} MessageBox MB_OK "系统为 2000 或 XP!" ${EndIf} ${If} ${AtMostWinXP} MessageBox MB_OK "系统版本为 XP 或更低版本的系统!" ${EndIf} FunctionEnd
示例2:
name "使用头文件判断操作系统" outfile '使用头文件判断操作系统.exe' !include "MUI.nsh" !include "WinVer.nsh" !insertmacro MUI_LANGUAGE "simpchinese" Section SectionEnd Function .onInit ${Unless} ${ISWinXP} MessageBox MB_OK "本程序只能安装在 Windows XP 系统上!" Abort ${EndIf} FunctionEnd