568数据 568数据


vbs判断磁盘类型和检测硬盘剩余空间的实现代码

网络编程 vbs判断磁盘类型和检测硬盘剩余空间的实现代码 06-21

核心代码:

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:ProgrammingApplications")
MsgBox message
message = ShowFreeSpace("F:ProgrammingApplications")
MsgBox message

VBS调用WMI遍历搜索硬盘文件并计数的方法
多年之前写的一个VBS调用WMI来遍历搜索硬盘文件,并计数的函数,今天整理网盘,看到了,发上来核心代码:Functionwmisfile(path_sf,justcnt)'OnErrorResumeNextStrCo

ComboBox 控件的用法教程
前面我们了解了ListBox(列表框)控件的使用,在vb.net中还有一个与ListBox控件十分相似的控件——ComboBox控件,也叫组合框。组合框控件包括两个部分,一

在windows 64位操作系统上运行32位的vbscript的方法
今天在2008r264位的服务器系统上,运行vbs文件的时候如下提示---------------------------WindowsScriptHost---------------------------脚本:C:UsersAdministratorDesktopvbs_cf.vbs


编辑:568数据

标签:控件,组合,遍历,硬盘,文件