Visual Basic Scripting Edition | 語言參考 |
返回字符串,其中包含文件的基本名 (不帶擴(kuò)展名), 或者提供的路徑說明中的文件夾。
object.GetBaseName(path)
object
必選項。應(yīng)為 FileSystemObject 的名稱。
path
必選項。指定文件或文件夾的路徑,要返回其組成部分的基本名。
如果路徑中沒有任何文件或文件夾與指定的 path 參數(shù)匹配,則 GetBaseName 方法返回零長度字符串 ("")。
下面例子舉例說明如何使用 GetBaseName 方法:
Function GetTheBase(filespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetTheBase = fso.GetBaseName(filespec)
End Function
注意 GetBaseName 方法只能對提供 path 的字符串起作用。它不能試圖分析一個路徑,也不能檢查指定路徑是否存在。
GetAbsolutePathName 方法 | GetDrive 方法 | GetDriveName 方法 | GetExtensionName 方法 | GetFile 方法 | GetFileName 方法 | GetFolder 方法 | GetParentFolderName 方法 | GetSpecialFolder 方法 | GetTempName 方法
應(yīng)用于:FileSystemObject 對象