VBS教程:方法-GetDriveName 方法


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 的字符串起作用。它不能试图分析一个路径,也不能检查指定路径是否存在。


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3