请各位大大看如何获取得操作系统的版本函数?
要以:“Windows 7 简体中文 32位” 要是XP加上SP3或SP2以下是我自己的函数,如有更好的函数,麻烦多谢共享一下;获取操作系统信息
Func _SYSTEM()
;++++++++++++++++++++++++++++++++
;本函数返回操作系统类型的详细信息
;++++++++++++++++++++++++++++++++
Local $SysTem = "" ;操作系统的全部名称
Local $SysTemVersion = "" ;操作系统的版本
Local $SysTemLanguage = "" ;操作系统的语言
Local $SysTemArch = "" ;操作系统的位宽
If @OSType = "WIN32_NT" Then ;判断是否为winNT系统,不是则退出
$SysTemVersion = StringSplit(@OSVersion, "_") ;取操作系统的版本
If @error Then Exit ;如果取不到操作系统的版本则退出
$SysTem = "Windows " & $SysTemVersion & " " & @OSServicePack & " "
Select ;选取操作系统语言
Case StringInStr("0404", @OSLang)
$SysTemLanguage = "中国(台湾)"
Case StringInStr("0804", @OSLang)
$SysTemLanguage = "简体中文"
Case StringInStr("0c04", @OSLang)
$SysTemLanguage = "繁体中文"
Case StringInStr("1004", @OSLang)
$SysTemLanguage = "中国(新加坡)"
Case StringInStr("1404", @OSLang)
$SysTemLanguage = "中国(澳门)"
Case StringInStr("0413 0813", @OSLang)
$SysTemLanguage = "Holland"
Case StringInStr("0409 0809 0c09 1009 1409 1809 1c09 2009 2409 2809 2c09 3009 3409", @OSLang)
$SysTemLanguage = "English"
Case StringInStr("040c 080c 0c0c 100c 140c 180c", @OSLang)
$SysTemLanguage = "French"
Case StringInStr("0407 0807 0c07 1007 1407", @OSLang)
$SysTemLanguage = "Germany"
Case StringInStr("0410 0810", @OSLang)
$SysTemLanguage = "Italy"
Case StringInStr("0414 0814", @OSLang)
$SysTemLanguage = "Norway"
Case StringInStr("0415", @OSLang)
$SysTemLanguage = "Poland"
Case StringInStr("0416 0816", @OSLang)
$SysTemLanguage = "Portugal"
Case StringInStr("040a 080a 0c0a 100a 140a 180a 1c0a 200a 240a 280a 2c0a 300a 340a 380a 3c0a 400a 440a 480a 4c0a 500a", @OSLang)
$SysTemLanguage = "Spain"
Case StringInStr("041d 081d", @OSLang)
$SysTemLanguage = "Sweden"
Case Else
$SysTemLanguage = "其他语言"
EndSelect
Select ;选取操作系统位宽
Case StringInStr("X86", @OSArch)
$SysTemArch = "32位"
Case StringInStr("IA64 X64", @OSArch)
$SysTemArch = "64位"
EndSelect
$SysTem = $SysTem & $SysTemLanguage & " " & $SysTemArch
Else
$SysTem = "获取操作系统出错,原因不是winNT系统!"
EndIf
Return $SysTem
EndFunc ;==>_SYSTEM 我绝得你这个已经是很好了,,根据帮助里面的改编过来的吧。。 wmi获取即可。
__wmi_Win32_OperatingSystem()
Func __wmi_Win32_OperatingSystem()
Local $wbemFlagReturnImmediately = 0x10
Local $wbemFlagForwardOnly = 0x20
Local $colItems = ""
Local $strComputer = "localhost"
Local $Output=""
$Output &= "Computer: " & $strComputer& @CRLF
$Output &= "==========================================" & @CRLF
Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$Output &= "名称: " & $objItem.Caption & @CRLF
$Output &= "版本: " & $objItem.CSDVersion & @CRLF
$Output &= "系统安装时间: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
$Output &= "开机时间: " & WMIDateStringToDate($objItem.LastBootUpTime) & @CRLF
$Output &= "区码: " & $objItem.Locale & @CRLF
Local $strMUILanguages = $objItem.MUILanguages(0)
$Output &= "语言: " & $strMUILanguages & @CRLF
$Output &= "操作系统构架: " & $objItem.OSArchitecture & @CRLF
$Output &= "序列号: " & $objItem.SerialNumber & @CRLF
$Output &= "系统设备: " & $objItem.SystemDevice & @CRLF
$Output &= "系统目录: " & $objItem.SystemDirectory & @CRLF
$Output &= "系统盘符: " & $objItem.SystemDrive & @CRLF
$Output &= "操作系统版本号: " & $objItem.Version & @CRLF
if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
$Output=""
Next
Else
Msgbox(0,"WMI 输出","没有在类 " & "Win32_OperatingSystem" & "中找到WMI对象" )
Endif
EndFunc
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc @OSServicePack 服务包if @OSServicePack='' then $sp=""
if @OSServicePack='Service Pack 1' then $sp="SP1"
if @OSServicePack='Service Pack 2' then $sp="SP2"
if @OSServicePack='Service Pack 3' then $sp="SP3"
if @OSServicePack='Service Pack 4' then $sp="SP4" #include <winapiex.au3>
_winapi_getversion() apiex有函数 回复 6# netegg
Netegg大大关于API函数我是一点都不懂,而且这个函数是获得的是结构,不懂如何输出,麻烦您给出一个实际的例子,我还是很喜欢API的,谢谢了。 #include <WinApiEx.au3>
Dim $x=_WinAPI_GetVersionEx()
; http://msdn.microsoft.com/en-us/library/ms724833%28v=VS.85%29.aspx
;~ typedef struct _OSVERSIONINFOEX {
;~ DWORD dwOSVersionInfoSize; ;数据结构大小
;~ DWORD dwMajorVersion; ;主版本
;~ DWORD dwMinorVersion; ;副版本
;~ DWORD dwBuildNumber; ;构建号
;~ DWORD dwPlatformId; ;平台ID
;~ TCHAR szCSDVersion; ;CSD版本, such as "Service Pack 3"
;~ WORDwServicePackMajor; ;SP主版本
;~ WORDwServicePackMinor; ;SP副版本
;~ WORDwSuiteMask; ;产品标识,用来识别集成了某些技术的(如VER_SUITE_BACKOFFICE)
;~ BYTEwProductType; ;产品类型,[[域控制器][服务器][工作站]]
;~ BYTEwReserved; ;保留,不使用
;~ } OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;
For $i=1 To 10
MsgBox(32,'',DllStructGetData($x,$i))
Next
$x=0
页:
[1]