设置或返回文件或文件夹的属性。 根据不同属性为读/写或只读。
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 对象
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器