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-04 04:19
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Seek batch processing to choose Y/N View 1,906 Replies 8
Original Poster Posted 2007-04-13 11:17 ·  中国 湖南 长沙 电信
初级用户
★★
Credits 103
Posts 52
Joined 2007-04-13 05:20
19-year member
UID 84975
Gender Male
Status Offline
I'm really sorry everyone~ Caicai looked for a whole afternoon and didn't find something that I can use~ Posting has taken up everyone's time~ Hope everyone can understand...

I want to make a BAT, with the following requirements:

After opening, choose whether to open 1.txt in the next step. If it's Y, open 1.txt, then the next step asks whether to open 2.txt. If I choose N in this step, skip it. The next step asks whether to open 3.txt, and so on. There may be dozens of steps asking Y or N

I wonder if it can be realized... Caicai is really too unskilled, causing trouble for everyone, very sorry
Floor 2 Posted 2007-04-13 11:44 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
Is it for pure DOS or for CMD? What is it used for? Explain in detail. How many steps are there? Is it unlimited?

See if the idea I said is correct:
Find *.TXT > File list > Menu call > Mouse selection > Open file > Return to menu to continue selection..... > Finally exit the menu!
Floor 3 Posted 2007-04-13 11:50 ·  中国 湖南 长沙 电信
初级用户
★★
Credits 103
Posts 52
Joined 2007-04-13 05:20
19-year member
UID 84975
Gender Male
Status Offline
Originally posted by 0451lym at 2007-4-12 10:44 PM:
Is it pure DOS or for CMD?
What is it used for? Be more detailed. How many steps are there? Is it infinite?

See if my thinking is correct:
Find *.TXT>File list>Menu call>Mouse selection>Open file>Return to menu to continue selection.....>Finally exit the menu!


For CMD, I was just giving an example for opening TXT.
Actually, I want to call BAT files.
No need to search, they are all in the same directory.
I just want to make a N-step selection BAT.
For example, I need to perform an operation on some files once a week.
Maybe this time I need to skip the operation of 2.BAT and do 3.BAT.
Maybe next time I don't skip.
So I want to ask how to do continuous Y/N selection.
It's not infinite steps.
Suppose there are 30 BAT files waiting for me to choose to skip or run.

Thanks for the great reply. I don't know what's going on. I always get server errors when reading posts here.
I was so anxious that I was sweating all afternoon.
Floor 4 Posted 2007-04-13 12:01 ·  中国 湖南 长沙 电信
初级用户
★★
Credits 103
Posts 52
Joined 2007-04-13 05:20
19-year member
UID 84975
Gender Male
Status Offline
Temporarily written like this~ I don't know if the idea is correct

SET /P ST=Please enter Y(xx1) or N(xx2):
echo.
if /I "%ST%"=="Y" goto xx1
if /I "%ST%"=="N" goto xx2

:xx1
start tt2.txt
goto xx2

:xx2
SET /P ST=Please enter Y(xx3) or N(xx4):
echo.
if /I "%ST%"=="Y" goto xx3
if /I "%ST%"=="N" goto xx4

:xx3
start tt3.txt
goto xx4
:xx4
SET /P ST=Please enter Y(xx5) or N(xx6):
echo.
if /I "%ST%"=="Y" goto xx5
if /I "%ST%"=="N" pause.
:xx5
start tt5.txt
pause.
Floor 5 Posted 2007-04-13 12:08 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
I throw a fast stone (don't know if it's right):
Suppose BAT has A B C D E F G ............(unlimited number)

@ECHO OFF
IF "%1"=="" CALL %0 A B C D E F G..........
:00
shift
IF "%0"=="" GOTO END
Command line 1
Command line 2
Command line 3........
GOTO 00
:END
EXIT

[ Last edited by 0451lym on 2007-4-13 at 12:15 PM ]
Floor 6 Posted 2007-04-13 21:45 ·  中国 河北 保定 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
In fact, one menu is simpler than asking questions one by one. List all batch processing into one menu, and the user can execute whichever one they want. After execution, return to the menu.

You can use the list function of wbat to achieve this.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 7 Posted 2007-04-14 02:09 ·  IANA 局域网IP(Private-Use)
初级用户
★★
Credits 186
Posts 92
Joined 2007-03-27 08:20
19-year member
UID 83047
Gender Male
Status Offline
A piece of cake,

Arrange your text as 1.txt 2.txt 3.txt........., can be ten thousand.

@echo off
set nub=1
:1
echo Do you want to open text %nub%
SET /P ST=Please enter Y(Open) or N(Don't open):
echo.
if /I "%ST%"=="N" set /A nub=%nub%+1 & goto 1
if /I "%ST%"=="Y" start %nub%.txt & set /A nub%=nub%+1 & goto 1
echo Incorrect input, please enter again & goto 1
Floor 8 Posted 2007-04-14 04:37 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Just casually looking at any post, there are such answers
Floor 9 Posted 2007-04-14 14:58 ·  中国 上海 电信
初级用户
Credits 24
Posts 12
Joined 2007-04-13 21:05
19-year member
UID 85038
Gender Male
Status Offline
Learned something new again~~~
Forum Jump: