中国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-15 21:06
47,813 topics / 349,903 posts / today 1 new / 48,258 members
DOS疑难解答 & 问题讨论 (解答室) » A question for you, and I hope to get your answer
Printable Version  803 / 3
Floor1 风之吻 Posted 2003-01-20 00:00
初级用户 Posts 2 Credits 108
Hello, expert:
I'll skip the polite talk. I have a question for you and hope to get your answer.
I made a boot disk (USB flash drive), and I want to make a batch file in it. After this batch file runs, a selection menu appears; after choosing the corresponding item, it executes the corresponding program. How should I write it?

Appendix
@echo off
path=%RAMD%:\;a:\;%CDROM%:\
cls
echo 1 dm
echo 2 diskgen
echo 0 quit
echo Please choose
choice/c

IF ERRORLEVEL 0 goto QUIT
IF ERRORLEVEL 1 goto 1
IF ERRORLEVEL 2 goto 2
goto QUIT
================It always gives an error here.
:1
path=a:\DM\
a:\DM\DM.com
goto QUIT

:2
path=a:\diskgen\
a:\diskgen\diskgen.exe
goto QUIT

:QUIT
echo.



Floor2 wqqqing Posted 2003-01-20 00:00
初级用户 Posts 7 Credits 119
Hehe, this is a problem with the IF ERRORLEVEL statement.
You should judge starting from the larger one.
Specifically:
IF ERRORLEVEL 2 goto 2
IF ERRORLEVEL 1 goto 1
IF ERRORLEVEL 0 goto QUIT
......

Or, after selecting the corresponding data, set an environment variable, and then use:
IF %environment variable%==""
to execute the corresponding program.
Floor3 风之吻 Posted 2003-01-23 00:00
初级用户 Posts 2 Credits 108
Thanks
Floor4 ko20010214 Posted 2003-07-04 00:00
版主 Posts 1,628 Credits 7,296
Learn how to ask questions first.

Make your post title better.

For posts with this kind of title, there may only be these three outcomes in the future:
1。Nobody will respond. (This is the best-case scenario.)
2。It gets moved to the off-topic section.
3。It gets deleted.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023