本帖最后由 mxxcgzxxx 于 2011-5-13 20:35 编辑
- @echo off&setlocal enabledelayedexpansion
- set p=0
- set /p a=起始文号,请用数字!:
- set /p b=终止文号,请用数字!:
- set /p c=文件后辍:四位以内的字符
- set /p d=需要补0的位数?如001为3,0001为4!:
- set /p e=你想什么前辍吗?:
- for /l %%1 in (%a%,1,%b%) do (
- call :补0 %%1 %d%
- echo !dat!
- cd.>!dat!.%c%
- )
- echo :eof
-
- :补0
- :test
- set "var=%1"
- set len=0
- for /l %%x in (0,1,20) do (
- set "var_=!var:~%%x,1!"
- if "!var_!"=="" goto :b
- set /a len+=1
- )
- :b
- set /a kg=%2-%len%
- set "dat="
- if %kg% leq 0 set dat=%1 & goto :eof
- for /l %%x in (1,1,%kg%) do set "dat=!dat!%p%"
- set "dat=!e!!dat!%1"
- goto :eof
复制代码
|