![]() |
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-18 02:13 |
47,814 topics / 349,907 posts / today 4 new / 48,259 members |
| DOS疑难解答 & 问题讨论 (解答室) » What can replace the CHOICE command under XP? |
| Printable Version 919 / 5 |
| Floor1 alfredhou | Posted 2006-04-11 17:17 |
| 初级用户 Posts 34 Credits 100 | |
|
Everyone:
Does anyone know what can be used under XP to replace the CHOICE command? I wrote a batch file and need to use CHOICE. It passed testing under WIN2003. But I ran into trouble on the LAN, because quite a large number of the machines are XP. Could someone help me out? Thanks! |
|
| Floor2 chenall | Posted 2006-04-11 18:03 |
| 银牌会员 Posts 469 Credits 1,276 From 福建泉州 | |
|
You can consider using SET /P
set /p select=Please enter your selection: if "%select%"=="1" command if "%select%"=="2" command |
|
| Floor3 alfredhou | Posted 2006-04-12 15:31 |
| 初级用户 Posts 34 Credits 100 | |
|
To the expert in reply #2, if something other than 1 or 2 is entered, then it won't be easy to control. What should be done?
|
|
| Floor4 alfredhou | Posted 2006-04-12 16:05 |
| 初级用户 Posts 34 Credits 100 | |
|
Reply #2, thanks, you gave me an idea. I wrote one, and now the main problem is that it can't make a default selection. Please help me think of a solution, thanks.
@echo off set /p select=Please enter your selection: if "%select%"=="1" (goto 1) else (goto 2) :1 command goto end :2 if "%select%"=="2" (command) else (goto end) :end pause |
|
| Floor5 smileseeker | Posted 2006-04-12 20:58 |
| 中级用户 Posts 83 Credits 316 | |
|
@echo off
:choose set /p select=Please enter your selection: if "%select%"=="1" echo Select 1 && goto tag if "%select%"=="2" echo Select 2 && goto tag ::The following is the default option pressing Enter directly means the default selection if "%select%"=="" echo Default selection && goto tag cls echo *************WRONG INPUT********** goto choose :tag pause [ Last edited by smileseeker on 2006-4-12 at 21:04 ] |
|
| Floor6 hxj | Posted 2006-04-13 03:45 |
| 中级用户 Posts 66 Credits 377 | |
|
Can it be like choice, where you set a time and if no key is pressed it automatically goes to the default selection?
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |