?
This document uses PHP Chinese website manual Release
JScript? | 語言參考 |
設(shè)置或返回文件或文件夾的屬性。 根據(jù)不同屬性為讀/寫或只讀。
object.Attributes [= newattributes]
object
必選項。 應(yīng)為 File 或 Folder 對象的名稱。
newattributes
可選項。 如果提供了這個部分,那么 newattributes 將成為指定的 object 的新屬性值。
newattributes 參數(shù)可以是下列各值或者這些值的任意邏輯組合:
常數(shù) | 值 | 描述 |
---|---|---|
Normal | 0 | 普通文件。 不設(shè)置屬性。 |
ReadOnly | 1 | 只讀文件。 屬性為讀/寫。 |
Hidden | 2 | 隱藏文件。 屬性為讀/寫。 |
System | 4 | 系統(tǒng)文件。 屬性為讀/寫。 |
Volume | 8 | 磁盤驅(qū)動器卷標(biāo)。 屬性為只讀。 |
Directory | 16 | 文件夾或目錄。 屬性為只讀。 |
Archive | 32 | 文件在上次備份后已經(jīng)修改。 屬性為讀/寫。 |
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 屬性
應(yīng)用于: File 對象 | Folder 對象