好绕啊。- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in (a.txt) do (
- set "str=%%a"&set "a="&set "faith="&set "trust="&set "false="
- set n=0
- if "!str:~,1!" equ "#" set a=a
- if "!str:~,1!" equ " " set a=a
- call :lp
- )
- pause>nul&exit/b
- :lp
- set/a n+=1
- if defined a call :lp1
-
- for /f "tokens=%n%* delims=# " %%a in ("%str%") do (
- set trust=trust
- if "%%b" neq "" (
- set var=!var!%%a
- if defined a goto lp
- ) else (
- set c=%%a
- ))
- if defined a goto result
- :lp1
- for /f "tokens=%n%* delims=0123456789." %%a in ("%str%") do (
- set false=false
- if "%%b" neq "" (
- set var=!var!%%a
- if not defined a goto lp
- ) else (
- set d=%%a
- ))
- if defined faith goto :eof
- if defined a goto :eof
- :result
- set/a c*=7
- if defined a set faith=faith&set/a n+=1&call :lp1
- if not defined trust echo %d%
- if not defined false echo %c%
- if defined trust if defined false echo %var%%c%%d%
- set "var="
复制代码
[ 本帖最后由 pusofalse 于 2008-8-8 14:42 编辑 ] |