lele9013 发表于 2008-12-21 15:23:14

如何提取 这个txt的文本信息

Drive   No.   ActiveVolumeLabe      Total (Mb)   Free (Mb)
C:        1:1         A                              45841        39919
D:        1:2                                      30474        22399
下面 可能还会有新的盘符

我要的是 C:=1:1 D:=1:2
如果有新的 如 E:=1;3 等 信息

lele9013 发表于 2008-12-21 15:29:18

现在用的是这个方法 请问 还能否简单一点????

#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("partinfo.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array   error:" & @error)
   Exit
EndIf
For $x = 2 to $aRecords
       
        if $aRecords[$x]="Drive   No.   ActiveVolumeLabe      Total (Mb)   Free (Mb)" Then
       
Else
       
$test=StringSplit($aRecords[$x],"        ")

MsgBox(0,0,$test&"   "&$test)

        EndIf
       
Next

pcbar 发表于 2008-12-21 16:46:04

$a=FileRead("d:\a.txt")
;MsgBox(0,0,$a)
$b=StringRegExp($a,':\s+\d:\d',3)

For $i=0 to UBound($b)
        ;MsgBox(0,'test',$b[$i])
        MsgBox(0,'test',StringRegExpReplace($b[$i],'\s+','='))
Next

小三 发表于 2008-12-21 16:49:52

简洁明了~~~~~~~
页: [1]
查看完整版本: 如何提取 这个txt的文本信息