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