![]() |
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-23 14:10 |
47,812 topics / 349,917 posts / today 0 new / 48,273 members |
| DOS批处理 & 脚本技术(批处理室) » Problems with the usage of set |
| Printable Version 3,296 / 5 |
| Floor1 luoxinxin1988 | Posted 2006-08-29 23:27 |
| 初级用户 Posts 48 Credits 190 | |
|
I wrote the following commands with a batch file:
@echo off set /p a= if %a%==1 goto 1 if %a%==2 goto 2 goto end :1 echo 1 goto end :2 echo 2 :end The problem is that when entering 1 or 2, the commands are executed respectively, but what if the input is not one of 1 or 2? So I want to ask, when the other party enters something that is not 1 or 2, how to write this script so that the window displays "No such command" Thank you! |
|
| Floor2 NaturalJ0 | Posted 2006-08-30 08:33 |
| 银牌会员 Posts 533 Credits 1,181 | |
|
@echo off
set /p a= if %a%==1 goto 1 if %a%==2 goto 2 echo No such command goto end :1 echo 1 goto end :2 echo 2 :end |
|
| Floor3 luoxinxin1988 | Posted 2006-08-30 18:22 |
| 初级用户 Posts 48 Credits 190 | |
|
Thanks
|
|
| Floor4 yadmek | Posted 2006-09-03 20:42 |
| 初级用户 Posts 8 Credits 20 | |
|
What does "set /p a=" represent?
|
|
| Floor5 zcnc | Posted 2012-12-12 15:37 |
| 新手上路 Posts 1 Credits 1 | |
|
Learning
|
|
| Floor6 zhaoziwei119 | Posted 2016-07-30 15:55 |
| 新手上路 Posts 6 Credits 11 | |
|
Thanks
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |