Dim a1,a2,a3,a4
Set a1=createobject("scripting.filesystemobject")
Set a2=a1.createtextfile("e:\14",true)
Set a4=a1.getfile("e:\14")
a4.attributes=ReadOnly
s=a4.attributes
Set a3=a1.opentextfile("e:\15.txt",2,true)
If a4.attributes=normal Then
a3.writeline"the attributes is normal"
a3.close
elseif a4.attributes=ReadOnly then
a3.writeline"the attributes is readonly"
a3.close
else
a3.writeline"the attributes is hidden"
a3.close
End If
每次我检查s都发现s被设置为0,即normal而不是readonly,为什么无法设置成readonly呢
原帖由 风过无息 于 2007-8-14 18:48 发表
Dim a1,a2,a3,a4
Set a1=createobject("scripting.filesystemobject")
Set a2=a1.createtextfile("e:\14.txt",true)
Set a2=nothing
Set a4=a1.getfile("e:\14.txt")
a4.attributes="1"
s=a4.attributes
...
Dim a1,a2,a3,a4
Set a1=createobject("scripting.filesystemobject")
Set a2=a1.createtextfile("e:\14",true)
Set a2=nothing
Set a4=a1.getfile("e:\14")
a4.attributes=readonly
s=a4.attributes
Set a3=a1.opentextfile("e:\15.txt",2,true)
If a4.attributes=normal Then
a3.writeline"the attributes is normal"
a3.close
elseif a4.attributes=readonly then
a3.writeline"the attributes is readonly"
a3.close
else
a3.writeline"the attributes is hidden"
a3.close
End If
可我释放了a2,结果还是一样啊sdlkfj9
原帖由 vincenthan 于 2007-8-14 10:48 发表
Dim a1,a2,a3,a4
Set a1=createobject("scripting.filesystemobject")
Set a2=a1.createtextfile("e:\14",true)
Set a4=a1.getfile("e:\14")
a4.attributes=ReadOnly
s=a4.attributes
Set a3=a1.opentext ...