Dim nowpath As String = Application.Startuppath()
东河ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!
Dim Result As String = nowpath.subString(0,nowpath.LastIndexOf("\"))
debug.writeline(Result)
手打的 若有拼写错误请自行修改
test.FileName = System.IO.Path.GetDirectoryName(test.FileName) "\" "新的文件名.扩展名"
用两个小数点表示,比如上级目录的abc子目录: ..\abc
一个小数点则表示当前目录,比如当前目录的abc子目录: .\abc ,当然也可以直接 abc
Public Function getParent(path As String) As String
If Right(path, 2) = ":\" Then '判读是否已经是根目录
getParent = ""
Exit Function
End If
If Right(path, 1) = "\" Then '去除最后一个\
path = Left(path, Len(path) - 1)
End If
path = Left(path, InStrRev(path, "\") - 1) '取父目录
If Right(path, 1) = ":" Then
path = path + "\"
End If
getParent = path
End Function