?
This document uses PHP Chinese website manual Release
JScript? | 語言參考 |
返回相應(yīng)于指定路徑中驅(qū)動器的 Drive 對象。
object.GetDrive ( drivespec );
object
必選項。 應(yīng)為 FileSystemObject 的名稱。
drivespec
必選項。 drivespec 參數(shù)可以是驅(qū)動器號 (c) 、帶冒號的驅(qū)動器號 (c:) 、帶冒號和路徑分隔符的驅(qū)動器號 (c:\) ,或者任意網(wǎng)絡(luò)共享的說明 (\\computer2\share1) 。
對于網(wǎng)絡(luò)共享,需要進(jìn)行檢查以確保共享存在。
如果 drivespec 和可接受的形式不一致或是不存在,那么將產(chǎn)生錯誤。
要在普通的路徑字符串上調(diào)用 GetDrive 方法,可以使用以下序列來獲取適于作為 drivespec 的字符串。
DriveSpec = GetDriveName(GetAbsolutePathName(Path))
下面的例子說明了 GetDrive 方法的用法。
function ShowFreeSpace(drvPath) {
???var fso, d, s ="";
???fso = new ActiveXObject("Scripting.FileSystemObject");
???d = fso.GetDrive(fso.GetDriveName(drvPath));
???s = "Drive " + drvPath.toUpperCase( ) + " - ";
???s += d.VolumeName + "<br>";
???s += "Free Space: " + d.FreeSpace/1024 + " Kbytes";
???return(s);
}
GetAbsolutePathName 方法 | GetBaseName 方法 | GetDriveName 方法 | GetExtensionName 方法 | GetFile 方法 | GetFileName 方法 | GetFileVersion 方法 | GetFolder 方法 | GetParentFolderName 方法 | GetSpecialFolder 方法 | GetTempName 方法應(yīng)用于: FileSystemObject 對象