China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-26 06:27
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » A question for you, and I hope to get your answer View 760 Replies 3
Original Poster Posted 2003-01-20 00:00 ·  中国 安徽 合肥 联通
初级用户
Credits 108
Posts 2
Joined 2003-01-20 00:00
23-year member
UID 768
Gender Male
Status Offline
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.



Floor 2 Posted 2003-01-20 00:00 ·  中国 广西 百色 电信
初级用户
Credits 119
Posts 7
Joined 2002-12-05 00:00
23-year member
UID 419
Gender Male
Status Offline
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.
Floor 3 Posted 2003-01-23 00:00 ·  中国 安徽 合肥 联通
初级用户
Credits 108
Posts 2
Joined 2003-01-20 00:00
23-year member
UID 768
Gender Male
Status Offline
Thanks
Floor 4 Posted 2003-07-04 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
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.
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Forum Jump: