中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 09:06
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Enter variable 101, create a new file with the number before 101
Printable Version  696 / 3
Floor1 lovehanbing520 Posted 2010-05-05 12:32
新手上路 Posts 18 Credits 18
Floor2 lovehanbing520 Posted 2010-05-05 15:34
新手上路 Posts 18 Credits 18
@echo off
color a
set /p SS=Please enter:
for /f "tokens=1,2 delims= " %%a in (d:\ssi\set.ini) do if "%ss%"=="%%b" set a=%%a&call
:dellfill
pause

:dellfill
@echo off
call :countdigit %a%
if %c% equ 4 copy nul >e:\user\000%a%.frt
if %c% equ 3 copy nul >e:\user\00%a%.frt
if %c% equ 2 copy nul >e:\user\0%a%.frt
if %c% equ 1 copy nul >e:\user\%a%.frt
goto :eof

:countdigit
@echo off
set b=%1
for /l %%c in (0,1,4) do if not "!b:~%%c!"=="" set c=%%c
goto :eof

This way it can only create one at a time~~~

If I enter: 101-113 then create 0001frt to 0010.frt, 10 files under E:\user\

How should this be written?`~
Floor3 Hanyeguxing Posted 2010-05-06 08:02
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
Requirement: in the set.ini text, the first character of the second column must not be 0


[ Last edited by Hanyeguxing on 2010-5-6 at 08:04 ]
Floor4 lovehanbing520 Posted 2010-05-06 10:52
新手上路 Posts 18 Credits 18
Mm, the first character in my second column isn't 0~~ I tested it, it works, thanks`
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023