Originally posted by pusofalse at 2008-6-19 18:57:
你确定下不会有重名的文件吗~?而且文件名全是字母?
子目录不确定有重名的文件,而且文件名不全是字母,可能是中文+字母+数字甚至符号呀作者: pusofalse 时间: 2008-6-19 19:05 @echo off&setlocal enabledelayedexpansion
for /r d:\ %%a in (*.txt) do set "%%~na=%%a"
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if defined %%a echo !%%a!
pause>nul作者: pusofalse 时间: 2008-6-19 19:12
Quote:
Originally posted by yywd at 2008-6-19 07:05 PM:
子目录不确定有重名的文件,而且文件名不全是字母,可能是中文+字母+数字甚至符号呀
Oh my god....
那你想要输出时,字母在最前面?然后数字,再后中文。。。
还是中文最前,数字最后?~
中文实在是不好考虑。。。。作者: yywd 时间: 2008-6-19 19:42
Quote:
Originally posted by pusofalse at 2008-6-19 19:12:
Oh my god....
那你想要输出时,字母在最前面?然后数字,再后中文。。。
还是中文最前,数字最后?~
中文实在是不好考虑。。。。
输出时数字在最前面,然后字母,再后中文。。。作者: pusofalse 时间: 2008-6-19 19:49 @echo off&setlocal enabledelayedexpansion
for /r d:\ %%a in (*.txt) do set "#%%~na=%%a"
for /f "tokens=2 delims==" %%a in ('set #') do echo %%a
pause>nul
输出类似于:
1
2
a
b
c
d
dp
dp23
dpa
DP
e
f
汉字
....
[ Last edited by pusofalse on 2008-6-19 at 07:53 PM ]作者: balinger 时间: 2008-6-19 19:59 @echo off
if exist "%temp%\list.txt" del /f/a/q "%temp%\list.txt"
for /r d: %%i in (*.txt) do echo %%~ni\%%i>>"%temp%\list.txt"
for /f "tokens=1* delims=\" %%i in ('more %%temp%%\list.txt^|sort') do echo %%j>>list.txt
del /f/a/q "%temp%\list.txt"
pause作者: yywd 时间: 2008-6-19 20:08
Quote:
Originally posted by pusofalse at 2008-6-19 19:49:
@echo off&setlocal enabledelayedexpansion
for /r d:\ %%a in (*.txt) do set "#%%~na=%%a"
for /f "tokens=2 delims==" %%a in ('set #') do echo %%a
pause>nul
输出类似 ...
谢谢您的热心帮助, 这个可以用的作者: yywd 时间: 2008-6-19 20:11
Quote:
Originally posted by balinger at 2008-6-19 19:59:
@echo off
if exist "%temp%\list.txt" del /f/a/q "%temp%\list.txt"
for /r d: %%i in (*.txt) do echo %%~ni\%%i>>"%temp%\list.txt"
for /f "tokens=1* delims= ...