Installshield判断系统版本
一、判断系统版本号:
1、用SYSINFO结构体获取
if ((SYSINFO.nWinMajor == 5 ) && (SYSINFO.nWinMinor >= 0)) then
MessageBox ("The system is more than XP.", SEVERE);
else
MessageBox ("The system is Window XP and before.", SEVERE);
endif;
2、通过查询注册表来判断系统:
NUMBER nOS,nvResult;
STRING svOS;
nOS = REGDB_NUMBER;
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
RegDBGetKeyValueEx( "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion","CurrentVersion", nOS, svOS, nvResult);
if (svOS == "6.0") then
MessageBox("We are on Vista!", INFORMATION);
else
if (svOS == "5.1") then
MessageBox("We are on XP!",INFORMATION);
endif;
endif;
3、调用 GetSystemInfo函数,具体函数用法参见help文档。
Operating system |
Version number |
dwMajor Version |
dwMinor Version |
Other |
Windows 7 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2008 R2 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Server 2008 |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Vista |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2003 R2 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) != 0 |
Windows Server 2003 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) == 0 |
Windows XP |
5.1 |
5 |
1 |
Not applicable |
Windows 2000 |
5.0 |
5 |
0 |
Not applicable |
Operating system |
Version number |
dwMajor Version |
dwMinor Version |
Other |
Windows 7 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2008 R2 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Server 2008 |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Vista |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2003 R2 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) != 0 |
Windows Server 2003 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) == 0 |
Windows XP |
5.1 |
5 |
1 |
Not applicable |
Windows 2000 |
5.0 |
5 |
0 |
Not applicable |
操作系统版本参数参考:
win8 6.2 6 2
Operating system |
Version number |
dwMajor Version |
dwMinor Version |
Other |
Windows 7 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2008 R2 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Server 2008 |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Vista |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2003 R2 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) != 0 |
Windows Server 2003 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) == 0 |
Windows XP |
5.1 |
5 |
1 |
Not applicable |
Windows 2000 |
5.0 |
5 |
0 |
Not applicable |
Operating system |
Version number |
dwMajor Version |
dwMinor Version |
Other |
Windows 7 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2008 R2 |
6.1 |
6 |
1 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Server 2008 |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows Vista |
6.0 |
6 |
0 |
OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows Server 2003 R2 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) != 0 |
Windows Server 2003 |
5.2 |
5 |
2 |
GetSystemMetrics(SM_SERVERR2) == 0 |
Windows XP |
5.1 |
5 |
1 |
Not applicable |
Windows 2000 |
5.0 |
5 |
0 |
Not applicable |
二、判断系统是32位还是64位:
1、在InstallShield 中,写脚本可以使用 SYSINFO.bIsWow64 来判断。
//判断Windows作系统是否为64位
if(SYSINFO.bIsWow64==1) then
MessageBox( "该系统为64位系统", MB_OK );
endif;
2、对于同时支持32/64位的打包来说,不仅限于脚本,Components等的属性都可以有效控制。在Components的Platform Suite(s)中设置平台互斥。