本帖最后由 tiandyoin 于 2024-10-26 15:24 编辑
回复 2# pusofalse - :GetFullpath
- @echo off&setlocal enabledelayedexpansion
- echo 短名: %~s1
- REM set "acc=C:\Users\test\AppData\Roaming\MICROS~1\Windows\SendTo\>添加~1.BAT"
- set "acc=%~s1"
- for /f "delims=" %%a in ("%acc%") do set "access=%%~da\"&set "file=%%~nxa"s
- for %%i in ("%access%" "%file%") do set "acc=!acc:%%~i=!"
- set "acc=%acc:\= %"
- for %%a in (%acc%) do (
- set "ac=%%a"
- call :lp
- )
- echo %access%%file%
- pause>nul&exit/b
- :lp
- echo "%access%%ac:~,6%*"
- for /f "delims=" %%a in ('dir/b "%access%%ac:~,6%*"') do (
- set "access=!access!%%a\"
- set ac&pause
- )
- @goto :EOF
复制代码
- D:\Users\test\Desktop\1_2 3>1.bat C:\Users\test\AppData\Roaming\MICROS~1\Windows\SendTo\>添加~1.BAT
- 短名: C:\Users\test\AppData\Roaming\MICROS~1\Windows\SendTo\>添加~1.BAT
- "C:\Users*"
- ac=Users
- acc=Users test AppData Roaming MICROS~1 Windows SendTo
- access=C:\Users\
- 请按任意键继续. . .
- "C:\Users\test*"
- ac=test
- acc=Users test AppData Roaming MICROS~1 Windows SendTo
- access=C:\Users\test\
- 请按任意键继续. . .
- "C:\Users\test\AppDat*"
- 找不到文件
- "C:\Users\test\Roamin*"
- 找不到文件
- "C:\Users\test\MICROS*"
- 找不到文件
- "C:\Users\test\Window*"
- 找不到文件
- "C:\Users\test\SendTo*"
- 找不到文件
- C:\Users\test\>添加~1.BAT
复制代码 6 个字符短名不够呀? |