VBS教程:方法-GetDrive 方法
GetDrive 方法
返回與指定的路徑中驅(qū)動器相對應(yīng)的 Drive 對象。
object.GetDrive drivespec
參數(shù)
object
必選項。應(yīng)為 FileSystemObject 的名稱。
drivespec
必選項。drivespec 可以是驅(qū)動器號 (c)、帶冒號的驅(qū)動器號 (c:)、帶有冒號與路徑分隔符的驅(qū)動器號 (c:\) 或任何指定的網(wǎng)絡(luò)共享 (\\computer2\share1)。
說明
對于網(wǎng)絡(luò)共享,檢查并確保該網(wǎng)絡(luò)共享存在。
若drivespec與已接受格式不一致或不存在,就會出錯。為了在調(diào)用 GetDrive 方法時使用標(biāo)準(zhǔn)路徑字符串,使用下列序列得到與 drivespec 相匹配的字符串:
DriveSpec = GetDriveName(GetAbsolutePathName(Path))下面示例說明如何使用 GetDrive 方法:
Function ShowFreeSpace(drvPath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(drvPath)) s = "Drive " & UCase(drvPath) & " - " s = s & d.VolumeName & "<BR>" s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0) s = s & " Kbytes" ShowFreeSpace = sEnd Function
相關(guān)文章
VBS ArrayList Class vbs中的數(shù)組類
VBS ArrayList Class vbs中的數(shù)組類...2007-03-03
VBS教程:函數(shù)-TimeSerial 函數(shù)
VBS教程:函數(shù)-TimeSerial 函數(shù)...2006-11-11
ntiIframe.vbs用于批量清除被添加到文件中的惡意代碼
ntiIframe.vbs用于批量清除被添加到文件中的惡意代碼...2007-03-03
使用 iisext.vbs 添加應(yīng)用程序依存關(guān)系的實現(xiàn)方法
這篇文章主要介紹了使用 iisext.vbs 添加應(yīng)用程序依存關(guān)系的實現(xiàn)方法,需要的朋友可以參考下2014-07-07
vbs循環(huán)產(chǎn)生的參數(shù)的傳遞問題
用vbs實現(xiàn)循環(huán)產(chǎn)生參數(shù)的傳遞問題,建議大家測試學(xué)習(xí)2008-06-06

