China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 09:56
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Enter variable 101, create a new file with the number before 101 View 697 Replies 3
Original Poster Posted 2010-05-05 12:32 ·  中国 江苏 移动
新手上路
Credits 18
Posts 18
Joined 2010-05-03 22:58
16-year member
UID 166056
Gender Male
Status Offline
Floor 2 Posted 2010-05-05 15:34 ·  中国 江苏 移动
新手上路
Credits 18
Posts 18
Joined 2010-05-03 22:58
16-year member
UID 166056
Gender Male
Status Offline
@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?`~
Floor 3 Posted 2010-05-06 08:02 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
Requirement: in the set.ini text, the first character of the second column must not be 0
@echo off
set /p SS=Please enter:
for /f "tokens=1,2 delims=-" %%a in ("%SS%") do for /f "usebackq tokens=1,2" %%c in ("d:\ssi\set.ini") do if "%%b"=="" (if %%a==%%d call:n %%c) else if %%d geq %%a if %%d leq %%b call:n %%c
pause&exit
:n
set n=000%1
cd.>"e:\user\%n:~-4%.frt"


[ Last edited by Hanyeguxing on 2010-5-6 at 08:04 ]
Floor 4 Posted 2010-05-06 10:52 ·  中国 江苏 移动
新手上路
Credits 18
Posts 18
Joined 2010-05-03 22:58
16-year member
UID 166056
Gender Male
Status Offline
Mm, the first character in my second column isn't 0~~ I tested it, it works, thanks`
Forum Jump: