vb 完整路径获取文件夹路径
path="c:\soft\中国人\setup.exe"如:dir(path)可以获取文件名,Left(path,InStr(path,"\"))可以获取磁盘路径,那获取...
path="c:\soft\中国人\setup.exe"
如:dir(path)可以获取文件名,Left(path, InStr(path, "\"))可以获取磁盘路径,那获取文件夹路径该怎么写? 展开
如:dir(path)可以获取文件名,Left(path, InStr(path, "\"))可以获取磁盘路径,那获取文件夹路径该怎么写? 展开
1个回答
展开全部
Path = "c:\soft\中国人\setup.exe"
For i = 1 To Len(Path)
If Mid(Path, i, 1) = "\" Then Print Left(Path, i)
Next i
或者:
Path = "c:\soft\中国人\setup.exe"
For i = 1 To Len(Path)
If Mid(Path, i, 1) = "\" Then Text1.Text = Left(Path, i)
Next i
将路径存放于text1内
For i = 1 To Len(Path)
If Mid(Path, i, 1) = "\" Then Print Left(Path, i)
Next i
或者:
Path = "c:\soft\中国人\setup.exe"
For i = 1 To Len(Path)
If Mid(Path, i, 1) = "\" Then Text1.Text = Left(Path, i)
Next i
将路径存放于text1内
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询