当前位置 博文首页 > VBS教程:方法-GetDriveName 方法

    VBS教程:方法-GetDriveName 方法

    作者:admin 时间:2021-02-09 21:23

    GetDriveName 方法

    返回包含指定路径中驱动器名的字符串。

    object.GetDriveName(path)

    参数

    object

    必选项。应为 FileSystemObject 的名称。

    path

    必选项。指定路径,要返回其组成部分的驱动器名。

    说明

    如果无法确定驱动器,则 GetDriveName 方法返回零长度字符串 ("")。

    下面例子举例说明如何使用GetDriveName 方法:

     Function GetAName(DriveSpec)  Dim fso  Set fso = CreateObject("Scripting.FileSystemObject")  GetAName = fso.GetDriveName(Drivespec)End Function

    注意   GetDriveName 方法只能对提供 path 的字符串起作用。它不能试图分析一个路径,也不能检查指定路径是否存在。

    js
下一篇:没有了