核心代码:
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" '网络硬盘 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
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索vbs
, 磁盘类型
硬盘剩余空间
linux 剩余磁盘空间、擦除磁盘剩余空间、c获取磁盘剩余空间、linux 查看磁盘剩余、查看磁盘剩余空间,以便于您获取更多的相关知识。
时间: 2024-10-27 23:09:34