vbs判斷磁盤類型和檢測硬盤剩余空間的實(shí)現(xiàn)代碼
更新時間:2016年10月11日 22:44:29 投稿:mdxy-dxy
這篇文章主要介紹了vbs判斷磁盤類型和檢測硬盤剩余空間的實(shí)現(xiàn)代碼,需要的朋友可以參考下
核心代碼:
Function ShowDriveType(drvpath)
Dim fso, d, t
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvpath))
Select Case d.DriveType
Case 0 t = "Unknown"
Case 1 t = "Removable" '移動硬盤
Case 2 t = "Fixed" '硬盤
Case 3 t = "Network" '網(wǎng)絡(luò)硬盤
Case 4 t = "CD-ROM"
Case 5 t = "RAM Disk" 'RAM
End Select
ShowDriveType = "Drive " & d.DriveLetter & ": - " & t
End Function
Function ShowFreeSpace(drvPath)
Dim fso, d, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvPath)) 'd為F:
s = "Drive " & UCase(drvPath) & " - "
s = s & d.VolumeName & " "
s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0)
s = s & " KBytes"
ShowFreeSpace = s
End Function
Dim message
message = ShowDriveType("F:\Programming\Applications")
MsgBox message
message = ShowFreeSpace("F:\Programming\Applications")
MsgBox message
相關(guān)文章
vbs判斷磁盤類型和檢測硬盤剩余空間的實(shí)現(xiàn)代碼
這篇文章主要介紹了vbs判斷磁盤類型和檢測硬盤剩余空間的實(shí)現(xiàn)代碼,需要的朋友可以參考下2016-10-10
bookfind 通過ISBN序號獲取圖書連接的書名與作者的vbs代碼
bookfind 通過ISBN序號獲取圖書連接的書名與作者的vbs代碼,類似小偷程序,通過正則匹配,雖然現(xiàn)在已經(jīng)無法使用,但代碼不錯,原理都有2011-12-12
VBS教程:VBscript屬性-Description 屬性
VBS教程:VBscript屬性-Description 屬性...2006-11-11
防止網(wǎng)頁腳本病毒執(zhí)行的方法-from web
防止網(wǎng)頁腳本病毒執(zhí)行的方法-from web...2007-02-02

