![]() |
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-09-30 03:43 |
47,813 topics / 349,918 posts / today 0 new / 48,278 members |
| DOS学习入门 & 精彩文章 (教学室) » About the choice command |
| Printable Version 4,417 / 17 |
| Floor1 hotdog | Posted 2003-08-16 00:00 |
| 中级用户 Posts 78 Credits 411 | |
|
The return code of the choice command is arranged in the order of the specified options. For example, in choice /c:dme defrag,mem,end, the return code for 'd' (defrag) is 1, the return code for'm' (mem) is 2, and the return code for 'e' (end) is 3. If you swap the order, the return code will change. For example, in choice /c:dem defragend,mem, the return code for 'd' (defragend) is 1, the return code for 'e' (end) is 2, and the return code for'm' (mem) is 3.
|
|
| Floor2 hotdog | Posted 2003-08-16 00:00 |
| 中级用户 Posts 78 Credits 411 | |
|
Why is there no one to help me?
|
|
| Floor3 Roy | Posted 2003-08-16 00:00 |
| 管理员 Posts 1,633 Credits 4,869 | |
The following is a quote from hotdog on 2003-8-16 3:12:22: choice /c:dem defrag,end,mem ^----Return code is 1 ^---Return code is 2 ^--Return code is 3 |
|
| Floor4 hotdog | Posted 2003-08-16 00:00 |
| 中级用户 Posts 78 Credits 411 | |
|
Then why is it written like this? Can you explain it?
@echo off choice /c:dme defrag,mem,end if errorlevel 3 goto defrag if errorlevel 2 goto mem if errotlevel 1 goto end |
|
| Floor5 hzy | Posted 2003-08-16 00:00 |
| 高级用户 Posts 135 Credits 578 | |
|
It's just that writing it like this is clearer!
You can write it like this: choice /c:dme d,m,e It can also be written like this: choice /c:dme The result is the same! |
|
| Floor6 hzy | Posted 2003-08-16 00:00 |
| 高级用户 Posts 135 Credits 578 | |
|
It's just that the prompts on the screen are different!
|
|
| Floor7 Roy | Posted 2003-08-16 00:00 |
| 管理员 Posts 1,633 Credits 4,869 | |
The following is a quote from hotdog on 2003-8-16 16:46:38: You made a mistake..... It should be like this: @echo off choice /c:dme defrag,mem,end if errorlevel 3 goto end if errorlevel 2 goto mem if errotlevel 1 goto defrag |
|
| Floor8 hzy | Posted 2003-08-16 00:00 |
| 高级用户 Posts 135 Credits 578 | |
The following is the speech of Roy on 2003-8-16 17:02:12:Hehe! I didn't pay attention either; |
|
| Floor9 xiaojun | Posted 2003-08-16 00:00 |
| 银牌会员 Posts 499 Credits 2,202 | |
|
Please clarify your specific context. The "if errorlevel 3 goto end" in batch scripting means if the error level of the previous command is greater than or equal to 3, then jump to the label "end". But without the full context of the surrounding batch code, it's hard to be more precise about which specific command's error it refers to. But based on the general syntax, that's the basic meaning. Please provide more context if possible.
|
|
| Floor10 zl7322 | Posted 2003-08-16 00:00 |
| 高级用户 Posts 269 Credits 871 | |
|
If the choice is 3, then execute end
|
|
| Floor11 hotdog | Posted 2003-08-16 00:00 |
| 中级用户 Posts 78 Credits 411 | |
|
I see. Thanks.
|
|
| Floor12 xiaojun | Posted 2003-08-16 00:00 |
| 银牌会员 Posts 499 Credits 2,202 | |
The following is a quote from zl7322 on 2003-8-16 22:42:11: Where is this 3 chosen? Isn't batch processing executed sequentially? |
|
| Floor13 hotdog | Posted 2003-08-17 00:00 |
| 中级用户 Posts 78 Credits 411 | |
| Floor14 死性不改 | Posted 2004-06-24 00:00 |
| 中级用户 Posts 88 Credits 378 | |
|
Been looking for this!
|
|
| Floor15 v70wl | Posted 2004-06-24 00:00 |
| 初级用户 Posts 1 Credits 106 | |
|
What does the choice command mean
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |