源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

VBS教程:方法-DriveExists 方法

  • 时间:2021-03-12 18:59 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:VBS教程:方法-DriveExists 方法

DriveExists 方法

如果指定的驱动器存在,则返回 [b]True[/b];否则返回 [b]False[/b]。 [code][i]object.[/i][b]DriveExists[/b][i](drivespec) [/i][/code] [h3]参数[/h3]object 必选项。应为 FileSystemObject 对象的名称。 drivespec 必选项。驱动器号或指定的完整路径。 [h3]说明[/h3]对于可移动媒体驱动器,即使驱动器中没有插入媒体,[b]DriveExists[/b] 方法仍返回 [b]True[/b]。用 [b]Drive[/b] 对象的 [b]IsReady[/b] 属性确定驱动器是否就绪。 下面例子举例说明如何使用 [b]DriveExists[/b] 方法:
[code] Function ReportDriveStatus(drv)   Dim fso, msg  Set fso = CreateObject("Scripting.FileSystemObject")  If fso.DriveExists(drv) Then    msg = ("[/code]驱动器[code] " & UCase(drv) & " [/code]存在。[code]")[/code][code]  Else[/code][code]    msg = ("[/code]驱动器[code] " & UCase(drv) & " [/code]不存在。[code]")[/code][code]  End If[/code][code]  ReportDriveStatus = msg[/code][code]End Function[/code]
[h3]请参阅[/h3]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部