本帖最后由 pan528 于 2013-5-27 18:45 编辑
按crlf的程序结构,改造了一下我的升序的批命令,效率提高了许多:- @echo off
- title 对目录文本按升序排列
-
- if "%~1"=="" goto:Ascending
-
- set File=%~snx1
-
- if exist A%File% del A%File%
- echo 正在对文本中的子项按升序排列,请稍候 ...
- (for /f "tokens=1* delims=_" %%i in ('%0^|sort') do echo %%j)>A%File%
- start A%File%
- exit /b
-
- :Ascending
- setlocal enabledelayedexpansion
- for /f "tokens=1* delims=_" %%i in (%File%) do (
- set m=%%i
- if "!m:~0,1!" == "0" set x=%%i echo !m:~0,10!_%%i_%%j
- echo !x:~0,10!_%%i_%%j
- )
- endlocal
- goto :eof
复制代码 但想请教一下crlf,我没有理解“if "%~1"=="" goto fun”,这段语句,拖拽时,“"%~1"=="" ”是怎么回事? |