Microsoft(R) Visual Basic(R) Scripting Edition
GetParentFolderName 方法
语言参考
起始页 | 版本 3

请参阅                   应用于


描述
返回字符串,该字符串包含指定的路径中最后一个文件或文件夹的父文件夹。
语法
object.GetParentFolderName(path)

GetParentFolderName 方法的语法有以下部分:

部分 描述
object 必选。应为 FileSystemObject 的名称。
path 必选。指定路径,要返回文件或文件夹的父文件夹名。

说明
如果 path 参数指定的文件或文件夹无父文件夹,则 GetParentFolderName 方法返回零长度字符串 ("")。

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

  Function GetTheParent(DriveSpec) 
  Dim fso
  Set fso = CreateObject("Scripting.FileSystemObject")
  GetTheParent = fso.GetParentFolderName(Drivespec)
End Function

注意   GetParentFolderName 方法仅应用于提供的 path 字符串。该方法不会辨识路径,也不检测路径是否存在。


(C) 1998 Microsoft Corporation. All rights reserved. Terms of Use.