//批處理文件的簡繁体轉換問題怎么解決? http://www.chenoe.com/blog/article.asp?id=2019//由于本人是繁体操作系統.如果路徑有漢字則复制文件失敗!如果是英文則沒有問題! 转成短路径: Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long '获得短文件名 Public Function GetShortPath(strFileName As String) As String Dim lngRes As Long, strPath As String strPath = String$(255, 0) lngRes = GetShortPathName(strFileName, strPath, 255) GetShortPath = Left$(strPath, lngRes) End Function
http://www.chenoe.com/blog/article.asp?id=2019//由于本人是繁体操作系統.如果路徑有漢字則复制文件失敗!如果是英文則沒有問題!
转成短路径:
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
'获得短文件名
Public Function GetShortPath(strFileName As String) As String
Dim lngRes As Long, strPath As String
strPath = String$(255, 0)
lngRes = GetShortPathName(strFileName, strPath, 255)
GetShortPath = Left$(strPath, lngRes)
End Function