NSIS使用WinVer.nsh头文件判断操作系统版本,
首先请下载最新的WinVer.nsh:
http://nsis.sourceforge.net/Include/WinVer.nsh(下载后置于\NSIS\Inclued中)
-
AtLeastWin
IsWin
AtMostWin
95、98、ME、NT4、2000、XP、2003、Vista、2008、7、2008R2,win8,win10,win11
示例1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 |
版权声明:
作者:心飞翔
链接:https://www.faystar.com/techshare/1988.html
来源:心飞翔
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
NSIS使用WinVer.nsh头文件判断操作系统版本,
首先请下载最新的WinVer.nsh:
http://nsis.sourceforge.net/Include/WinVer.nsh(下载后置于\NSIS\Inclued中)
AtLeastWin 检测是否高于指定版本
IsWin 检测……
共有 0 条评论