Attributes 属性

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

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

object.Attributes [= newattributes]

参数

object

必选项。 应为 File 或 Folder 对象的名称。

newattributes

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

设置

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

常数

描述

Normal

0

普通文件。 不设置属性。

ReadOnly

1

只读文件。 属性为读/写。

Hidden

2

隐藏文件。 属性为读/写。

System

4

系统文件。 属性为读/写。

Volume

8

磁盘驱动器卷标。 属性为只读。

Directory

16

文件夹或目录。 属性为只读。

Archive

32

文件在上次备份后已经修改。 属性为读/写。

Alias

64

链接或者快捷方式。 属性为只读。

Compressed

128

压缩文件。 属性为只读。

说明

下面的代码通过一个文件说明了 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);

}

请参阅

DateCreated 属性 DateLastAccessed 属性 DateLastModified 属性 Drive 属性 Files 属性 IsRootFolder 属性 Name 属性 ParentFolder 属性 Path 属性 ShortName 属性 ShortPath 属性 Size 属性 SubFolders 属性 Type 属性

应用于: File 对象 Folder 对象

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航