怎么获得TEMP文件夹的长路径。
如题,不知道各位是怎么获得这个长路径的,怎么API,FSO都是短路径呢、。
[解决办法]
Option ExplicitPrivate Declare Function GetLongPathName Lib "kernel32" Alias "GetLongPathNameA" _(ByVal lpszShortPath As String, ByVal lpszLongPath As String, ByVal cchBuffer As Long) As LongPrivate Sub Form_Load()Dim a As String, b As String, c As Longa = Environ("Temp")b = Dir(a & "\*.*")b = a & "\" & bDim L As String * 1000c = GetLongPathName(b, L, 999&)Debug.Print LEnd Sub
[解决办法]
Private Sub Command1_Click() Set fso = CreateObject("Scripting.FileSystemObject") Set sh = CreateObject("Shell.Application") MsgBox sh.NameSpace(fso.GetSpecialFolder(2).Path).Self.PathEnd Sub