今天转悠的时候偶然间发现bjsh版主发的这个Vbs教程,真的相当不错:http://www.cn-dos.net/forum/viewthread.php?tid=30588。以后我就可能会不时地从中摘记一些东西啦。
★①②③④⑤⑥⑦⑧⑨⑩㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫ【●】→←↑↓▲
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
MsgBox "1",,"2"
Set fs=CreateObject("scripting.filesystemobject")
'Set ff=fs.GetFile("d:\bak\11.txt")
'MsgBox ff
'i=ff.Attributes
'MsgBox i
Set fo=fs.OpenTextFile("d:\bak\11.txt")
'MsgBox fo
v=fo.Read(5)
MsgBox v
line1=fo.ReadLine
line2=fo.ReadLine
MsgBox line2
con=fo.ReadAll
MsgBox con
'11.txt文件的内容可以是这样:
cndos.1111 aaa
22222Dim myarray(5)
myarray(0)="Unknown"
myarray(1)="Removable"
myarray(2)="Fixed"
myarray(3)="Remote"
myarray(4)="CD-ROM"
myarray(5)="RAM-Drive"
'find out the type of drives
Set fs = CreateObject("scripting.filesystemobject")
'get all drives:
Set drives = fs.Drives
' Drives属性:返回一个Drives集合,包含了本机上所有可用的Drive对象
For Each drive In drives
letter = drive.DriveLetter
kind = myarray(drive.DriveType)
list = list & "Drive " & letter & " is of type "& kind & vbCr
Next
' DriveLetter属性:返回盘符
' DriveType属性:返回一个数值,指示驱动器类型,事实上系统的定义和该例上面的定义是一致的。
MsgBox listMyArray="unknown;Removable;Fixed;Remote;CD-ROM;RAM-Drive"
MyArray=Split(MyArray,";")
.......Myarray(0)="This "
Myarray(1)="is "
Myarray(2)="Billunique"
MyString=Join(Myarray)
'Then MyString="This is Billunique"