怎么得到文件的目录名,有这样的函数吗?

怎么得到文件的目录名,有这样的函数吗?
比如,我c:\aa\test.txt
我想用一个函数取去目录c:\aa
---------------------------------------------------------------

GetParentFolderName 方法

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

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

1<script language="VBScript">   
2Function GetTheParent(DriveSpec)   
3Dim fso   
4Set fso = CreateObject("Scripting.FileSystemObject")   
5GetTheParent = fso.GetParentFolderName(Drivespec)   
6Set fso = Nothing   
7End Function   
8MsgBox GetTheParent("C:\Program Files\Internet Explorer\IEXPLORE.EXE")   
9</script>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus