FSO 列磁盘信息

Function tran(Driver)
Select Case Driver
Case 0: tran="设备无法识别"
Case 1: tran="软盘驱动器"
Case 2: tran="硬盘驱动器"
Case 3: tran="网络硬盘驱动器"
Case 4: tran="光盘驱动器"
Case 5: tran="RAM虚拟磁盘"
End Select
End Function
set fso=CreateObject("Scripting.FileSystemObject")
For each drv in fso.Drives
   If drv.IsReady=TRUE Then
WSCRIPT.ECHO   "盘符"&drv.DriveLetter
WSCRIPT.ECHO   "型号"&tran(drv.DriveType)
WSCRIPT.ECHO   "卷标"&drv.VolumeName
WSCRIPT.ECHO   "总计大小"&FormatNumber(drv.TotalSize / 1024, 0)&"kb"
WSCRIPT.ECHO   "可用空间"&FormatNumber(drv.Availablespace / 1024, 0)&"kb"
WSCRIPT.ECHO   "文件系统"&drv.FileSystem
WSCRIPT.ECHO   "序列号"&drv.SerialNumber
WSCRIPT.ECHO   "是否就绪"&drv.IsReady
WSCRIPT.ECHO   "路径"&drv.Path
   End If
  
   If drv.IsReady=False Then
WSCRIPT.ECHO   "盘符"&vblrlf&drv.DriveLetter&vbcrlf&tran(drv.DriveType)&vbcrlf&"是否就绪"&drv.IsReady&vbcrlf&"路径"&drv.Path
   End if
   
Next
set fs=nothing

你可能感兴趣的:(职场,FSO,休闲, 列磁盘)