回复 2# proteus
非常感谢你。
这是 Au3 官网别人给的解决方法:#region Global Constants
Global Const $PRODUCT_BUSINESS = 0x00000006 ; Business
Global Const $PRODUCT_BUSINESS_N = 0x00000010 ; Business N
Global Const $PRODUCT_CLUSTER_SERVER = 0x00000012 ; HPC Edition
Global Const $PRODUCT_DATACENTER_SERVER = 0x00000008 ; Server Datacenter (full installation)
Global Const $PRODUCT_DATACENTER_SERVER_CORE = 0x0000000C ; Server Datacenter (core installation)
Global Const $PRODUCT_DATACENTER_SERVER_CORE_V = 0x00000027 ; Server Datacenter without Hyper-V (core installation)
Global Const $PRODUCT_DATACENTER_SERVER_V = 0x00000025 ; Server Datacenter without Hyper-V (full installation)
Global Const $PRODUCT_ENTERPRISE = 0x00000004 ; Enterprise
Global Const $PRODUCT_ENTERPRISE_E = 0x00000046 ; Enterprise E
Global Const $PRODUCT_ENTERPRISE_N = 0x0000001B ; Enterprise N
Global Const $PRODUCT_ENTERPRISE_SERVER = 0x0000000A ; Server Enterprise (full installation)
Global Const $PRODUCT_ENTERPRISE_SERVER_CORE = 0x0000000E ; Server Enterprise (core installation)
Global Const $PRODUCT_ENTERPRISE_SERVER_CORE_V = 0x00000029 ; Server Enterprise without Hyper-V (core installation)
Global Const $PRODUCT_ENTERPRISE_SERVER_IA64 = 0x0000000F ; Server Enterprise for Itanium-based Systems
Global Const $PRODUCT_ENTERPRISE_SERVER_V = 0x00000026 ; Server Enterprise without Hyper-V (full installation)
Global Const $PRODUCT_HOME_BASIC = 0x00000002 ; Home Basic
Global Const $PRODUCT_HOME_BASIC_E = 0x00000043 ; Home Basic E
Global Const $PRODUCT_HOME_BASIC_N = 0x00000005 ; Home Basic N
Global Const $PRODUCT_HOME_PREMIUM = 0x00000003 ; Home Premium
Global Const $PRODUCT_HOME_PREMIUM_E = 0x00000044 ; Home Premium E
Global Const $PRODUCT_HOME_PREMIUM_N = 0x0000001A ; Home Premium N
Global Const $PRODUCT_HYPERV = 0x0000002A ; Microsoft Hyper-V Server
Global Const $PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = 0x0000001E ; Windows Essential Business Server Management Server
Global Const $PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = 0x00000020 ; Windows Essential Business Server Messaging Server
Global Const $PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = 0x0000001F ; Windows Essential Business Server Security Server
Global Const $PRODUCT_PROFESSIONAL = 0x00000030 ; Professional
Global Const $PRODUCT_PROFESSIONAL_E = 0x00000045 ; Professional E
Global Const $PRODUCT_PROFESSIONAL_N = 0x00000031 ; Professional N
Global Const $PRODUCT_SERVER_FOR_SMALLBUSINESS = 0x00000018 ; Windows Server 2008 for Windows Essential Server Solutions
Global Const $PRODUCT_SERVER_FOR_SMALLBUSINESS_V = 0x00000023 ; Windows Server 2008 without Hyper-V for Windows Essential Server Solutions
Global Const $PRODUCT_SERVER_FOUNDATION = 0x00000021 ; Server Foundation
Global Const $PRODUCT_SMALLBUSINESS_SERVER = 0x00000009 ; Windows Small Business Server
Global Const $PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = 0x00000019 ; Small Business Server Premium Edition
Global Const $PRODUCT_STANDARD_SERVER = 0x00000007 ; Server Standard (full installation)
Global Const $PRODUCT_STANDARD_SERVER_CORE = 0x0000000D ; Server Standard (core installation)
Global Const $PRODUCT_STANDARD_SERVER_CORE_V = 0x00000028 ; Server Standard without Hyper-V (core installation)
Global Const $PRODUCT_STANDARD_SERVER_V = 0x00000024 ; Server Standard without Hyper-V (full installation)
Global Const $PRODUCT_STARTER = 0x0000000B ; Starter
Global Const $PRODUCT_STARTER_E = 0x00000042 ; Starter E
Global Const $PRODUCT_STARTER_N = 0x0000002F ; Starter N
Global Const $PRODUCT_STORAGE_ENTERPRISE_SERVER = 0x00000017 ; Storage Server Enterprise
Global Const $PRODUCT_STORAGE_EXPRESS_SERVER = 0x00000014 ; Storage Server Express
Global Const $PRODUCT_STORAGE_STANDARD_SERVER = 0x00000015 ; Storage Server Standard
Global Const $PRODUCT_STORAGE_WORKGROUP_SERVER = 0x00000016 ; Storage Server Workgroup
Global Const $PRODUCT_UNDEFINED = 0x00000000 ; An unknown product
Global Const $PRODUCT_ULTIMATE = 0x00000001 ; Ultimate
Global Const $PRODUCT_ULTIMATE_E = 0x00000047 ; Ultimate E
Global Const $PRODUCT_ULTIMATE_N = 0x0000001C ; Ultimate N
Global Const $PRODUCT_WEB_SERVER = 0x00000011 ; Web Server (full installation)
Global Const $PRODUCT_WEB_SERVER_CORE = 0x0000001D ; Web Server (core installation)
Global Const $PRODUCT_UNLICENSED = 0xABCDABCD ; Product has not been activated and is no longer in the grace period
#endregion Global Constants
Global $iMajorVer ; Major OS version number >= 6
Global $iMinorVer ; Minor OS version number
Global $iMajorSP = 0 ; Major service pack number
Global $iMinorSP = 0 ; Minor service pack number
Global $aRET, $iProdType, $sProdType
MsgBox(0,"",GetOSVer())
Func GetOSVer()
For $iMajorVer = 6 To 8
For $iMinorVer = 0 To 4
$aRET = DllCall("kernel32.dll", "dword", "GetProductInfo", "dword", $iMajorVer, "dword", $iMinorVer, "dword", $iMajorSP, "dword", $iMinorSP, "dword*", 0)
If (@error = 0) And $aRET[0] Then
$iProdType = $aRET[5]
Switch $iProdType
Case $PRODUCT_BUSINESS
$sProdType = "Business Edition"
Case $PRODUCT_BUSINESS_N
$sProdType = "Business Edition N"
Case $PRODUCT_CLUSTER_SERVER
$sProdType = "Cluster Server Edition"
Case $PRODUCT_DATACENTER_SERVER
$sProdType = "Datacenter Edition"
Case $PRODUCT_DATACENTER_SERVER_CORE
$sProdType = "Datacenter Edition (core installation)"
Case $PRODUCT_DATACENTER_SERVER_V
$sProdType = "Datacenter Edition without Hyper-V"
Case $PRODUCT_DATACENTER_SERVER_CORE_V
$sProdType = "Datacenter Edition without Hyper-V (core installation)"
Case $PRODUCT_ENTERPRISE
$sProdType = "Enterprise Edition"
Case $PRODUCT_ENTERPRISE_SERVER
$sProdType = "Enterprise Edition"
Case $PRODUCT_ENTERPRISE_SERVER_V
$sProdType = "Enterprise Edition without Hyper-V"
Case $PRODUCT_ENTERPRISE_SERVER_CORE
$sProdType = "Enterprise Edition (core installation)"
Case $PRODUCT_ENTERPRISE_SERVER_CORE_V
$sProdType = "Enterprise Edition without Hyper-V (core installation)"
Case $PRODUCT_ENTERPRISE_SERVER_IA64
$sProdType = "Enterprise Edition for Itanium-based Systems"
Case $PRODUCT_HOME_BASIC
$sProdType = "Home Basic Edition"
Case $PRODUCT_HOME_BASIC_E
$sProdType = "Home Basic Edition E"
Case $PRODUCT_HOME_BASIC_N
$sProdType = "Home Basic Edition N"
Case $PRODUCT_HOME_PREMIUM
$sProdType = "Home Premium Edition"
Case $PRODUCT_HOME_PREMIUM_E
$sProdType = "Home Premium Edition E"
Case $PRODUCT_HOME_PREMIUM_N
$sProdType = "Home Premium Edition N"
Case $PRODUCT_HYPERV
$sProdType = "Microsoft Hyper-V Server"
Case $PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT
$sProdType = "Windows Essential Business Server Management Server"
Case $PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING
$sProdType = "Windows Essential Business Server Messaging Server"
Case $PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY
$sProdType = "Windows Essential Business Server Security Server"
Case $PRODUCT_PROFESSIONAL
$sProdType = "Professional"
Case $PRODUCT_PROFESSIONAL_E
$sProdType = "Professional E"
Case $PRODUCT_PROFESSIONAL_N
$sProdType = "Professional N"
Case $PRODUCT_SERVER_FOR_SMALLBUSINESS
$sProdType = "Windows Server 2008 for Windows Essential Server Solutions"
Case $PRODUCT_SERVER_FOR_SMALLBUSINESS_V
$sProdType = "Windows Server 2008 without Hyper-V for Windows Essential Server Solutions"
Case $PRODUCT_SERVER_FOUNDATION
$sProdType = "Server Foundation"
Case $PRODUCT_SMALLBUSINESS_SERVER
$sProdType = "Small Business Server"
Case $PRODUCT_SMALLBUSINESS_SERVER_PREMIUM
$sProdType = "Small Business Server Premium Edition"
Case $PRODUCT_STANDARD_SERVER
$sProdType = "Standard Edition"
Case $PRODUCT_STANDARD_SERVER_CORE
$sProdType = "Standard Edition (core installation)"
Case $PRODUCT_STANDARD_SERVER_V
$sProdType = "Standard Edition without Hyper-V"
Case $PRODUCT_STANDARD_SERVER_CORE_V
$sProdType = "Standard Edition without Hyper-V (core installation)"
Case $PRODUCT_STARTER
$sProdType = "Starter Edition"
Case $PRODUCT_STARTER_E
$sProdType = "Starter Edition E"
Case $PRODUCT_STARTER_N
$sProdType = "Starter Edition N"
Case $PRODUCT_STORAGE_ENTERPRISE_SERVER
$sProdType = "Storage Server Enterprise"
Case $PRODUCT_STORAGE_EXPRESS_SERVER
$sProdType = "Storage Server Express"
Case $PRODUCT_STORAGE_STANDARD_SERVER
$sProdType = "Storage Server Standard"
Case $PRODUCT_STORAGE_WORKGROUP_SERVER
$sProdType = "Storage Server Workgroup"
Case $PRODUCT_UNDEFINED
$sProdType = "UNDEFINED"
Case $PRODUCT_ULTIMATE
$sProdType = "Ultimate Edition"
Case $PRODUCT_ULTIMATE_E
$sProdType = "Ultimate Edition E"
Case $PRODUCT_ULTIMATE_N
$sProdType = "Ultimate Edition N"
Case $PRODUCT_WEB_SERVER
$sProdType = "Web Server Edition"
Case $PRODUCT_WEB_SERVER_CORE
$sProdType = "Web Server (core installation)"
Case $PRODUCT_UNLICENSED
$sProdType = "UNLICENSED"
EndSwitch
ConsoleWrite($iMajorVer & ":" & $iMinorVer & " - $iProdType = " & $iProdType & "; $sProdType = " & $sProdType & @LF)
Else
ConsoleWrite($iMajorVer & ":" & $iMinorVer & " - Fail: @error = " & @error & @LF)
EndIf
Next
Next
Return $sProdType
EndFunc
|