Vbscript 我对一个小概念感到困惑

Vbscript 我对一个小概念感到困惑,vbscript,qtp,Vbscript,Qtp,我对VBscript非常陌生,并且努力学习所有的概念。在我的练习中,我被一个疑问所困扰 dim a,b,c set a = CreateObject("scripting.filesystemobject") 'initiate the file system object' set b = a.GetFolder("E:\test") 'returns a object . and for the instance that varaiable b refers to that returne

我对VBscript非常陌生,并且努力学习所有的概念。在我的练习中,我被一个疑问所困扰

dim a,b,c
set a = CreateObject("scripting.filesystemobject") 'initiate the file system object'
set b = a.GetFolder("E:\test") 'returns a object . and for the instance that varaiable b refers to that returned object'
c = b.datecreated 'accesing and storing the property to a variable /C/'
msgbox "folder: " &c
当我执行此命令时,没有错误消息,并且工作正常。但当我改变

c=b.datecreated
TO
set c=b.datecreated

它显示了这个错误:

> object required:'datecreated'

我知道这是一件基本的事情,但有时一些小事情会让你学到很多东西,对未来很有帮助。

关键字
Set
在VBScript中仅用于分配对象:

set a = CreateObject("scripting.filesystemobject")
指定非对象(如创建日期)时不设置
Set

c = b.datecreated

(这是我最喜欢的VBScript的污点。)

。。。有很多可供选择的列表!对我来说,问题不在于不一致,而在于缺乏文档——用户应该通过口耳相传了解这些小怪癖。我最喜欢的缺点是使用默认方法创建对象,而不使用参数,如
Public default Function Value()”作为字符串。在创建这样一个方法时,这似乎是一个聪明的举动,但最终您将始终需要查找像
MyDictionary.addObjectWithDefaultFunction
这样的内容。