本帖最后由 tangtian 于 2014-1-24 15:42 编辑
- @ECHO OFF & SETLOCAL enabledelayedexpansion
- FOR /F %%i in ('dir 20*.txt /b') DO (SET str=%%i
- FOR /F "tokens=*" %%j in (%%i) DO (SET str=%%j
-
- IF "!str:~0,10!" == "tablename=" SET str1=!str:~10!
- IF not "!str:~0,10!" == "tablename=" SET str2=!str!
-
- )
-
- set strlen=0
- for /l %%i in (0,1,30) do (
- if "!str1:~%%i,1!"=="" (if !strlen!==0 set strlen=%%i)
- )
-
- echo !str2:strlen,100!
- )
复制代码 从str2中变量的起始位置,读取字符 |