![]() |
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-04 06:17 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Seek batch processing to choose Y/N |
| Printable Version 1,907 / 8 |
| Floor1 flybird2020 | Posted 2007-04-13 11:17 |
| 初级用户 Posts 52 Credits 103 | |
|
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 |
|
| Floor2 0451lym | Posted 2007-04-13 11:44 |
| 高级用户 Posts 357 Credits 760 | |
|
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! |
|
| Floor3 flybird2020 | Posted 2007-04-13 11:50 |
| 初级用户 Posts 52 Credits 103 | |
Originally posted by 0451lym at 2007-4-12 10:44 PM: 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. |
|
| Floor4 flybird2020 | Posted 2007-04-13 12:01 |
| 初级用户 Posts 52 Credits 103 | |
|
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. |
|
| Floor5 0451lym | Posted 2007-04-13 12:08 |
| 高级用户 Posts 357 Credits 760 | |
|
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 ] |
|
| Floor6 Climbing | Posted 2007-04-13 21:45 |
| 铂金会员 Posts 2,753 Credits 6,962 From 河北保定 | |
|
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. |
|
| Floor7 lp1129 | Posted 2007-04-14 02:09 |
| 初级用户 Posts 92 Credits 186 | |
|
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 |
|
| Floor8 vkill | Posted 2007-04-14 04:37 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
Just casually looking at any post, there are such answers
|
|
| Floor9 fyb198351 | Posted 2007-04-14 14:58 |
| 初级用户 Posts 12 Credits 24 | |
|
Learned something new again~~~
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |