au3 如何将长文件名转成 短文件名
诸如:c:\Documents and Settings\Administrator\AppData\Local\Application Data\Application Data\Application Data\Application Data\Application Data\
C:\DOCUME~1\ADMINI~1\AppData\Local\APPLIC~1\APPLIC~1\APPLIC~1\APPLIC~1\APPLIC~1\
很多程序都无法突破255个字符。
特提出讨论。 XP下测试的话,必须用有效的路径。
Dim $lShortPath
Dim $lLongPath="C:\Documents and Settings\Administrator\Application Data"
Dim $iLongPathLength=StringLen($lLongPath)
$iLongPathLength+=1
Dim $tLongPath=DllStructCreate("wchar["&$iLongPathLength&"]")
Dim $pLongPath=DllStructGetPtr($tLongPath)
DllStructSetData($tLongPath,1,$lLongPath)
Dim $iShortPathLength=StringLen($lLongPath)
$iShortPathLength+=1
Dim $tShortPath=DllStructCreate("wchar["&$iShortPathLength&"]")
Dim $pShortPath=DllStructGetPtr($tShortPath)
Dim $iResult=DllCall("Kernel32.dll","DWORD","GetShortPathNameW","ptr",$pLongPath,"ptr",$pShortPath,"DWORD",$iShortPathLength)
MsgBox(0,"",DllStructGetData($tShortPath,1)) Dim $lLongPath="C:\Documents and Settings\Administrator\Application Data"
Dim $iResult = DllCall("kernel32.dll","long","GetShortPathNameW","wstr",$lLongPath,"wstr","","long",StringLen($lLongPath)+1)
If Not @error Then MsgBox(0,"",$iResult) 只读出了C:\DOCUME~1? 帮顶学习。。。。。。。。。。。。。。。。。。 回复 1# bhffhzh MsgBox(0,"",FileGetShortName("C:\Program Files\Common Files"))如上用现成的,有什么问题么?请教~~ 回复 8# boyhong
假设c盘下有“program filesss”这样的目录,那么有filegetshortname函数就会得到错误结果(正确结果是progra~2。 回复boyhong
假设c盘下有“program filesss”这样的目录,那么有filegetshortname函数就会得到错误结果 ...
gplane 发表于 2014-7-7 10:28 http://61.153.183.105/images/common/back.gif
您在一楼写的短文件名不就是8.3规则短文件名?
页:
[1]