Attributes 属性

80酷酷网    80kuku.com

  

 

设置或返回文件或文件夹的属性。 根据不同属性为读/写或只读。

object.Attributes [= newattributes]

参数

object

必选项。 应为 FileFolder 对象的名称。

newattributes

可选项。 如果提供了这个部分,那么 newattributes 将成为指定的 object 的新属性值。

设置

newattributes 参数可以是下列各值或者这些值的任意逻辑组合:

常数描述
Normal0普通文件。 不设置属性。
ReadOnly1只读文件。 属性为读/写。
Hidden2隐藏文件。 属性为读/写。
System4系统文件。 属性为读/写。
Volume8磁盘驱动器卷标。 属性为只读。
Directory16文件夹或目录。 属性为只读。
Archive32文件在上次备份后已经修改。 属性为读/写。
Alias64链接或者快捷方式。 属性为只读。
Compressed128压缩文件。 属性为只读。

说明

下面的代码通过一个文件说明了 Attributes 属性的用法:

function ToggleArchiveBit(filespec){   var fso, f, r, s;   fso = new ActiveXObject("Scripting.FileSystemObject");   f = fso.GetFile(filespec)   if (f.attributes && 32)   {      f.attributes = f.attributes - 32;      s = "Archive bit is cleared.";   }   else   {      f.attributes = f.attributes + 32;      s =   "Archive bit is set.";   }   return(s);}

请参阅

| | | | | | | | | | | | |
应用于: |



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: