当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > VBS教程:方法-GetDriveName 方法
VBScript 中的 VBS教程:方法-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 的字符串起作用。它不能试图分析一个路径,也不能检查指定路径是否存在。
评论 (0) All