求分解文件名和路径的代码,比如file_name_full = "c:\windows\command\cmd.com"如何得到file_path = "c:\windows\command\" file_name =

jinhailong 2003-03-04 02:58:35
求分解文件名和路径的代码,比如file_name_full = "c:\windows\command\cmd.com"如何得到file_path = "c:\windows\command\" file_name = "cmd.com"
...全文
124 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2003-03-04
  • 打赏
  • 举报
回复
Function shortpath(ByVal longpath As String) As String
Dim temp
temp = Split(longpath, "\")
shortpath = temp(UBound(temp))
End Function

Private Sub Command1_Click()
MsgBox shortpath("c:\windows\command\cmd.com")
End Sub
生活真美好 2003-03-04
  • 打赏
  • 举报
回复
gz
Cooly 2003-03-04
  • 打赏
  • 举报
回复
Private Sub Form_Load()
file_name_full = "c:\windows\command\cmd.com"
file_path = Left(file_name_full, InStrRev(file_name_full, "\"))
file_name = Right(file_name_full, Len(file_name_full) - InStrRev(file_name_full, "\"))
MsgBox file_path
MsgBox file_name
End Sub

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧