中国DOS联盟论坛

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-12 12:24
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » [Help] Question about a batch file problem, could Master Rushi help me take a look?
Printable Version  1,461 / 9
Floor1 柏仔 Posted 2003-05-26 00:00
初级用户 Posts 100 Credits 478
I changed 98 to DOS using your method, but I want to be able to choose at startup whether to enter DOS or 98, so I added this to AUTOEXEC.BAT:

choice /c:dw Dos,Windows
if errorlevel 2 echo Welcome To Dos!
if errorlevel 1 win

But no matter whether I press D or W, it only enters 98. What should I do?
Sorry to trouble you


Floor2 如是大师 Posted 2003-05-26 00:00
元老会员 Posts 3,351 Credits 9,654 From 湖北
Please post the complete batch file...............
Floor3 Wengier Posted 2003-05-27 00:00
系统支持 Posts 10,521 Credits 27,736
if errorlevel 1 win

should be changed to:

if errorlevel l if not errorlevel 2 win
Floor4 柏仔 Posted 2003-05-27 00:00
初级用户 Posts 100 Credits 478
The following is quoted from Master Rushi's post at 2003-5-26 23:54:12:
Please post the complete batch file...............

My batch file only has this little bit ^_^
Floor5 如是大师 Posted 2003-05-27 00:00
元老会员 Posts 3,351 Credits 9,654 From 湖北
@ECHO OFF
PROMPT $p$g
set temp=%ramd%:\
set tmp=%ramd%:\
path=o:\;%RAMD%:\
choice/c:evrn please press
if errorlevel 4 goto ndd
if errorlevel 3 goto pv
if errorlevel 2 goto kv
if errorlevel 1 goto end

:Ndd
LH Ndd.exe
goto end

:pv
FINDRAMD>NUL
set path=%ramdrive%\;%path%
%ramdrive%
CD \
LH PVIEW
goto end

:kv
FINDRAMD>NUL
set path=%ramdrive%\;%path%
%ramdrive%
CD \
LH kv3000
goto end
Look at this file—what do you think your file is missing?
Floor6 柏仔 Posted 2003-05-27 00:00
初级用户 Posts 100 Credits 478
Although I've read the batch programming article written by the boss, I still don't really know how to use it

Is my file missing subroutines?
Floor7 柏仔 Posted 2003-05-27 00:00
初级用户 Posts 100 Credits 478
I just changed it to

choice /c:dw Dos,Windows
if errorlevel 2 goto win
if errorlevel 1 goto dos

:win
win

:dos
echo Welcome To Dos!!!



It worked ^_^!!
But I still don't quite understand why??
Floor8 Wengier Posted 2003-05-27 00:00
系统支持 Posts 10,521 Credits 27,736
Changing it to:

if errorlevel l if not errorlevel 2 win

works.

Because ERRORLEVEL 1 actually means ERRORLEVEL >=1

Master Rushi made this mistake just now too!
Floor9 如是大师 Posted 2003-05-27 00:00
元老会员 Posts 3,351 Credits 9,654 From 湖北
Ah~ I accept the criticism.
Floor10 柏仔 Posted 2003-05-27 00:00
初级用户 Posts 100 Credits 478
Thanks to both of you
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023