|
发表于 2017-3-26 22:19:10
|
显示全部楼层
本帖最后由 skysmile 于 2017-3-26 22:21 编辑
我有类似功能的源码
;将常用系统信息存储到 sysinfo.ini文件
Func _sysinfo()
local $mem1, $mem3
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colBoard = $objWMIService.ExecQuery("SELECT * FROM Win32_computersystem")
$colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
$colCPU = $objWMIService.ExecQuery("Select * from CIM_Processor")
$colVideoinfo = $objWMIService.ExecQuery("Select * from Win32_VideoController")
$wnc = $objwmiservice.execquery("select * from win32_physicalmemory")
;获取主机型号
For $object In $colBoard
IniWrite($temp & "\sysinfo.ini", "系统信息", "主机型号", $object.Model)
Next
;获取CPU信息
For $object In $colCPU
IniWrite($temp & "\sysinfo.ini", "系统信息", "CPU", $object.Name)
Next
;获取显卡信息
For $object In $colVideoinfo
IniWrite($temp & "\sysinfo.ini", "系统信息", "显卡", $object.Description)
Next
;获取操作系统信息
For $objOperatingSystem In $colSettings
IniWrite($temp & "\sysinfo.ini", "系统信息", "操作系统", $objOperatingSystem.Caption & " 版本 " & $objOperatingSystem.BuildNumber & " " & @OSArch)
Next
;获取启动方式
If _WinAPI_GetLastError() = $ERROR_INVALID_FUNCTION Then
IniWrite($temp & "\sysinfo.ini", "系统信息", "启动方式", 'UEFI Boot Mode')
Else
IniWrite($temp & "\sysinfo.ini", "系统信息", "启动方式", 'Legacy BIOS')
EndIf
;获取内存大小
For $object In $wnc
$mem = String(Int($object.capacity / 1048576))
If $mem1 = "" Then
$mem1 = $mem & "MB"
$mem2 = ""
Else
$mem1 &= "/" & $mem & "MB"
$mem2 = "(" & $mem1 & ")"
EndIf
$mem3 += $mem
Next
$nc = $mem3 & "MB" & $mem2
IniWrite($temp & "\sysinfo.ini", "系统信息", "内存", $nc)
EndFunc |
|