本帖最后由 pcl_test 于 2015-3-2 12:28 编辑
回复 1# 终_焉 - @echo off
- setlocal enabledelayedexpansion
- ::dir /a-d/b是列出文件名,dir /ad/b列出文件夹名,如果名字中有空格,一个空格算一个字符
- for /f "delims=" %%i in ('dir /a-d /b') do >>"list.txt" echo,%%i
- echo 导出列表完毕
- echo 正在对列表进行排序
- for /f "delims=" %%a in ('type "list.txt"') do (
- >>$1 echo,%%a¥
- )
- for /f "delims=" %%b in ('type $1') do (
- set "str=%%b"
- set len=0
- for /l %%c in (0 1 1000) do (
- if "!str:~%%c,1!" == "¥" set "len=%%c" && call :endlen !str! !len!
- )
- )
- for /l %%d in (1 1 200) do (
- findstr /c:"¥%%d¥" $2 >>$3
- )
- for /f "tokens=1* delims=¥" %%e in ('type $3') do >>$ echo,%%e
- move $ "list.txt"
- echo 排序完毕
- del $*
- pause & exit
- :endlen
- >>$2 echo,!str!!len!¥
- goto :eof
复制代码
|