联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
01电影 0101动作片 010101国内 01010101大陆 01010102港台 010102国外 01010201欧美 01010202日韩 0102动画片 010201国内 010202国外
SETLOCAL ENABLEDELAYEDEXPANSION for /f %%x in (dirs.txt) do call :circle "%%x" goto :eof :circle set "line=%~1" set "left=!line:~0,2!" set "right=!line:~2!" set dirs= ::左边不含有数字,行错误退出 for /f %%r in ('echo !left!^|findstr /r "^"') do goto :goon goto :enext :goon ::右边非数字起首,顶级目录,直接创建退出 for /f %%r in ('echo !right!^|findstr /r "^"') do goto :deepgoon set "!left!=!line!" set "dirs=!dirs!!line!" ::echo "!dirs!" md "!dirs!" goto :next :deepgoon if not defined !left! goto :enext for /f %%i in ('call call echo %%%left%%%') do set "t_t=%%i" set "dirs=!dirs!!t_t!\" set t_t= set "left=!left!!right:~0,2!" set "right=!right:~2! goto :goon :enext echo 此行数据有问题,跳过 :next
@echo off setlocal EnableDelayedExpansion for /f %%a in (dirs.txt) do ( call :getnum %%a ) pause & exit /b :getnum set n= set str=%1 :loop set /a n+=2 if "!str:~%n%,1!" lss "Z" goto loop set num=!str:~,%n%! set up=%num:~,-2% set %num%=!%up%!\%1 md "G:!%num%!"
@Echo Off & Setlocal EnableDelayedExpansion Set /a y=0 For /f "Usebackq Delims=" %%a in ("%~dp0dirs.txt") do ( set "var=%%a" & set "_Path=" set /a x=0 & Call :Loop If !x! Leq !y! (set /a c=y-x For /L %%i in (0 1 !c!) do set "_Path=!_Path!..\" ) set /a y=x cd "!_Path!" >nul & Md "%%a" & cd "%%a" ) Pause & Exit /b :Loop If Defined var set /a x+=1 & set "var=%var:~2%" & Goto :Loop
01020301 01020302 0102030101 0102030202
Originally posted by pusofalse at 2008-11-22 03:36 AM: 被这题难住了,一度卡壳,看这样对吗? @Echo Off & Setlocal EnableDelayedExpansion Set /a y=0 For /f "Usebackq Delims=" %%a in ("%~dp0dirs.txt") do ...
@Echo Off & Setlocal EnableDelayedExpansion Set /a y=0 For /f "Usebackq Delims=" %%a in ("%~dp0dirs.txt") do ...
Originally posted by tireless at 2008-11-22 01:31 AM: @echo off setlocal EnableDelayedExpansion for /f %%a in (dirs.txt) do ( call :getnum %%a ) pause & exit /b :getnum set n= set str=%1 :loop set /a n+=2 if "!str:~%n%,1! ...
@echo off setlocal EnableDelayedExpansion for /f %%a in (dirs.txt) do ( call :getnum %%a ) pause & exit /b :getnum set n= set str=%1 :loop set /a n+=2 if "!str:~%n%,1! ...
不过似乎遇到有单数字打头的目录可能会有问题,但应该不会有这种目录出现,字母倒是有可能的,是否比较处用"A"好点?
if "!str:~%n%,1!" leq "9" goto loop