木头人 发表于 2015-5-19 10:27:46

诚心求助关于多字符串的获取方式。。

FilesystemManager diagnostic...
===============================

Volume 1
VolumePos: 1.2:
DriveLetter: C:
Description:   30.20GB Disk 0 Offset   329MB   30.20GB VMware, VMware Virtual S 1.0
Type:      fsfNtfsWindowsXP
Name:      

Volume 2
VolumePos: 1.3:
DriveLetter: E:
Description:   29.48GB Disk 0 Offset   30.52GB   29.48GB VMware, VMware Virtual S 1.0
Type:      fsfNtfsWindowsXP
Name:      

Volume 3
VolumePos: 2.1:
DriveLetter: D:
Description:       1GB Primary Disk 1 Offset      64KB       1GB VMware, VMware Virtual S 1.0
Type:      fsfNtfsWindowsXP
Name:      

Volume 4
VolumePos: D1.1:
DriveLetter: F:
Description:    1.05GB F: Simple   WIN-1TUU2GD9P4Q-Dg0
Type:      fsfNtfsWindowsXP
Name:      

Volume 5
VolumePos: D1.2:
DriveLetter: G:
Description:    3.92GB G: Simple   WIN-1TUU2GD9P4Q-Dg0
Type:      fsfNtfsWindowsXP
Name:      

Volume 6
VolumePos: D1.3:
DriveLetter: H:
Description:    1.99GB H: SpannedWIN-1TUU2GD9P4Q-Dg0
Type:      fsfNtfsWindowsXP
Name:      

Volume 7
VolumePos: 1.1:
DriveLetter:
Description:   200MB Disk 0 Offset       1MB   200MB VMware, VMware Virtual S 1.0
Type:      fsfFat32
Name:      

Volume 8
VolumePos: 80.1:

如何从上面的文本中获取 Volume 1开头 至 未知的 Volume *之间的所有 VolumePos 后面的 X:X 以及DriveLetter后面的 X: 呢,然后获取至 VolumePos 后如果是 80.X 开头的则停止获取。
将结果传输至 A.TXT

nofindx 发表于 2015-5-22 00:07:06

#include <Array.au3>
Local $hFileOpen = FileOpen("C:\Users\wuhy\Desktop\1.txt",0)
Local $newFileOpen = FileOpen("C:\Users\wuhy\Desktop\2.txt",1)
Local $aArray = FileReadToArray($hFileOpen)
Local $index = _ArrayFindAll($aArray,"VolumePos:",0,0,0,1)
$num = 0
While $num <= UBound($index)
        $linePos = FileReadLine($hFileOpen,$index[$num]+1)
        $lineLetter = FileReadLine($hFileOpen,$index[$num] + 2)
        $slinePos = StringTrimLeft(StringStripWS($linePos,8),10);删除 VolumePos 后获得后面的值
        $slineLetter = StringTrimLeft(StringStripWS($lineLetter,8),10) ;删除 DriveLetter 后获得后面的值
        FileWriteLine($newFileOpen,$slinePos & "" & $slineLetter & @CRLF)
        $num = $num + 1
        If StringInStr($slinePos,"80.") <> 0Then Exit
WEnd
页: [1]
查看完整版本: 诚心求助关于多字符串的获取方式。。