我对一些小概念感到困惑 [英] i am confused in a small concepts
问题描述
我对 VBscript 非常陌生,并且正在努力学习所有概念.在我的练习中,我一直在怀疑.
I am very new to VBscript and learning hard all the concepts. During my practice I am stuck with a doubt.
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
当我执行此操作时,没有错误消息并且工作正常.但是当我改变
When I execute this there is no error message and it works fine. But when I change
c = b.datecreated
TO set c = b.datecreated
比
它显示此错误:
> object required:'datecreated'
我知道这是一件基本的事情,但有时小事情会让你学到很多东西,对未来有帮助.
I know it's a basic thing but some time small things make you learn a lot and helpful for future.
推荐答案
关键字 Set
在 VBScript 中仅用于对象分配:
The keyword Set
is used in VBScript only for assignment of objects:
set a = CreateObject("scripting.filesystemobject")
非对象 - 如创建日期 - 在没有 Set
的情况下分配.
Non-objects - like the creation date - are assigned without Set
.
c = b.datecreated
(这是我最喜欢的 VBScript 的坏处.)
(This is my favorite nastiness of VBScript.)
这篇关于我对一些小概念感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!