本帖最后由 laomeng 于 2013-7-9 11:21 编辑 #include <Array.au3>
#include <File.au3>
Local $Ini = @ScriptDir & "\Config.ini"
Local $regreturn
Local $ID
regPCI()
Func regPCI()
Dim $key="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI",$regreturn[0]
For $i = 1 to 30
$var = RegEnumKey($key, $i)
if @error <> 0 Then ExitLoop
For $n=1 To 20
$subvarname=$key&""&$var
$subvar=RegEnumKey($subvarname,$n)
If @error <> 0 Then ExitLoop
$aaa=RegRead($subvarname&""&$subvar&"","class")
$hdid=RegRead($subvarname&""&$subvar&"","HardwareID")
$bb=StringSplit($hdid,@CRLF)
If UBound($bb)>5 Then
$cc=StringSplit($bb[1],"&")
$regre=$cc[1]&"&"&$cc[2]
Else
$cc=StringSplit($bb[1],"&")
$regre=$cc[1]&"&"&$cc[2]
EndIf
$ID = $ID & $regre & @LF & 'ID='
;将数据写入到标准INI文件的一个字段.
IniWriteSection($Ini, "PCI", $ID)
Next
next
EndFunc
近段时间忙,又忘了好多了。
借助大神的例子获取了PCI设备ID,同时也写入INI中。现有两个问题,大神帮帮忙。 1.发现第一行的“ID=” 换行了 推移到后面了;2.读取一个包含以下ID的INI文件(格式是一样的ID=“”)。如何将相同的ID显示出来呢?TKS[PCI]
PCI\VEN_1002&DEV_4383
ID=PCI\VEN_1002&DEV_4384
ID=PCI\VEN_1002&DEV_4385
ID=PCI\VEN_1002&DEV_4390
ID=PCI\VEN_1002&DEV_4396
ID=PCI\VEN_1002&DEV_4396
ID=PCI\VEN_1002&DEV_4396
ID=PCI\VEN_1002&DEV_4397
ID=PCI\VEN_1002&DEV_4397
ID=PCI\VEN_1002&DEV_4397
ID=PCI\VEN_1002&DEV_4399
ID=PCI\VEN_1002&DEV_439C
ID=PCI\VEN_1002&DEV_439D
ID=PCI\VEN_1002&DEV_970F
ID=PCI\VEN_1002&DEV_9714
ID=PCI\VEN_1022&DEV_1200
ID=PCI\VEN_1022&DEV_1201
ID=PCI\VEN_1022&DEV_1202
ID=PCI\VEN_1022&DEV_1203
ID=PCI\VEN_1022&DEV_1204
ID=PCI\VEN_1022&DEV_9601
ID=PCI\VEN_1022&DEV_9602
ID=PCI\VEN_1022&DEV_9604
ID=PCI\VEN_1022&DEV_9605
ID=PCI\VEN_1022&DEV_9606
ID=PCI\VEN_1022&DEV_9607
ID=PCI\VEN_10EC&DEV_8168
ID=PCI\VEN_10EC&DEV_8168
ID=PCI\VEN_1106&DEV_3432
ID=PCI\VEN_13C1&DEV_1002
ID=PCI\VEN_168C&DEV_002B
ID=
|