本帖最后由 apang 于 2014-11-4 19:14 编辑
回复 15# wangx - @echo off&setlocal enabledelayedexpansion
-
- set "_strlen=set ##=&(for %%a in (2048 1024 512 256 128 64 32 16)do if ^!$:~%%a^!. NEQ . set/a##+=%%a&set $=^!$:~%%a^!)&set $=^!$^!fedcba9876543210&set/a##+=0x^!$:~16,1^!"
-
- for /f "delims=" %%a in (1.txt) do (
- set "str=%%a"
- if "!str:/=!" NEQ "!str!" (
- call :Lp "%%a"
- ) else (
- for /f "tokens=1* delims=\" %%a in ("!str!") do (
- echo \%%b %%a
- )
- )
- )
- pause & exit/b
-
- :Lp
- for /f "tokens=1* delims=/" %%a in ("%~1") do (
- if "%%b" NEQ "" (
- call :Lp "%%b"
- ) else (
- set "$=%%a#"
- (%_strlen%)
- for %%a in (!##!) do echo !str! !str:~0,-%%a!
- )
- )
复制代码
|