请教:如何把文件里的字符和数字,输出给变量?
文本文件hd1.txt,里面内容如下(例):
Disk Partitions Cylinders Heads Sectors Mbytes Model
1 7 14593 255 63 114473.5 ST3120026AS
Partition Status Type Volume Label Mbytes System Usage
C: 1 A PRIMARY 7538.3 NTFS/HPFS 7%
2 H PRIMARY 7467.7 NTFS/HPFS 7%
3 EXTENDED 99464.9 87%
D: 4 LOGICAL 10001.4 NTFS/HPFS 9%
E: 5 LOGICAL 15006.0 NTFS/HPFS 13%
F: 6 LOGICAL APPZ 30004.2 FAT32 26%
G: 7 LOGICAL 44453.3 NTFS/HPFS 39%
要求:
根据设定或输入的盘符(比如set drive=E:),检查hd1.txt,找到E:对应的分区号是5,但是要求type为EXTENDED 后的分区号要减去1,也就是说,输入E:,要求输出4,输入G:,要求输出6。
谢谢。
[ Last edited by lianjiang2004 on 2006-11-27 at 01:30 AM ]
文本文件hd1.txt,里面内容如下(例):
Disk Partitions Cylinders Heads Sectors Mbytes Model
1 7 14593 255 63 114473.5 ST3120026AS
Partition Status Type Volume Label Mbytes System Usage
C: 1 A PRIMARY 7538.3 NTFS/HPFS 7%
2 H PRIMARY 7467.7 NTFS/HPFS 7%
3 EXTENDED 99464.9 87%
D: 4 LOGICAL 10001.4 NTFS/HPFS 9%
E: 5 LOGICAL 15006.0 NTFS/HPFS 13%
F: 6 LOGICAL APPZ 30004.2 FAT32 26%
G: 7 LOGICAL 44453.3 NTFS/HPFS 39%
要求:
根据设定或输入的盘符(比如set drive=E:),检查hd1.txt,找到E:对应的分区号是5,但是要求type为EXTENDED 后的分区号要减去1,也就是说,输入E:,要求输出4,输入G:,要求输出6。
谢谢。
[ Last edited by lianjiang2004 on 2006-11-27 at 01:30 AM ]

