joeblackzqq
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

分类:

技术点:

相关文章:

  • 2022-01-02
  • 2021-06-25
  • 2022-12-23
  • 2021-11-24
  • 2021-10-11
  • 2022-12-23
  • 2022-03-12
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 2022-12-23
  • 2022-03-07
  • 2021-11-05
  • 2021-06-11
  • 2021-05-22
  • 2021-10-04
相关资源
相似解决方案