【发布时间】:2015-08-13 14:03:36
【问题描述】:
我想我有我想要的(如下所述),再次感谢您,但请再提供两个选项...当我想在子菜单中添加两个下一个选项时,例如“B”,例如继续开始和“E”像退出。它会是这样的:
你好,我是Zedd,请在下面选择一个应用程序:
- 记事本
- 计算
- 其他
当我像其他人一样触摸“3”时,我会得到下一个菜单:
- FFox
- IE
- 或 B. 返回
- 或E.退出
我该怎么做?我可以只使用数字 0-9 还是也可以使用 10,11 等?
代码示例可能是这样的?
@echo off
:begin
echo.
echo Hello, I'm Zedd...
echo.
echo Choose:
echo.
echo 1. Notepad
echo 2. Calc
echo 3. Other
echo.
choice /c 123
if %errorlevel%==1 goto :Notepad
if %errorlevel%==2 goto :Calc
if %errorlevel%==3 goto :Other
:Notepad
start notepad.exe
goto :eof
:Calc
start calc.exe
goto :eof
:Other
echo.
echo Choose:
echo.
echo 1. FFox
echo 2. IE
echo 3 or B. Back
echo 4 or E. Exit
echo.
choice /c 1234(maybe 12be if I can use also b and e, or I can use 3,4... is possible here use 10,11,12 etc.?)
if %errorlevel%==1 "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
if %errorlevel%==2 "C:\Program Files\Internet Explorer\iexplore.exe"
if %errorlevel%==3 goto :begin?
if %errorlevel%==4 exit?
goto :other (I want to stay in other for choosing next apps but I want to be able to go back or exit)
另外,我可以用note来做吗,所以当我选择FFox时会有消息“你选择了FFox”等?
希望我描述清楚,如果你能帮助我,我会很高兴,谢谢!
您能否告诉我如何使用包含不同选项和操作的批处理文件编写CMD 中的命令?
我已经研究了我可以使用的功能的一个很好的描述,但我无法将它们在功能上组合在一起。
这是我在 Windows 上运行批处理文件时想要的输出消息示例:
我需要做批处理,例如“test.bat”
我认为这是最简单的方法。在这批中,我想要一些文本和一些选择。例如下面:
Hello, I am Zedd, here is few options for you, please choose one.
1. Run notepad.exe
2. Other apps
输入数字 1 后,记事本打开。输入数字 2 后,应该会显示更多选项:
1. Firefox
2. More informations
etc.
我需要在 Windows 上运行这个批处理文件。
最好的方法是什么?
它可以是全屏或仅在一个窗口内。
我还需要打开的应用程序或图片等。
【问题讨论】:
-
它是 实际 MS-DOS 还是只是 cmd 窗口?您是否真的在运行 MS-DOS 6(或您正在使用的旧系统上的任何版本)?因为这两者之间实际上存在巨大的差异,并且某些命令对另一个不起作用。
-
问题指出“我的批处理文件在 Windows 上运行”。
-
只是cmd windows,这里有哪些可能性?是的,你是对的,很抱歉,如果可能的话,我会纠正它......
-
全屏?不带批次。打开程序或应用程序?是的(例如只是
notepad.exe)。使用选项?是 - 如果程序或应用程序支持它们。如果您不说明具体问题,很难为您提供帮助。 -
好的,所以我需要的都是可能的,但我不知道该怎么做......所以我尝试再次描述它。我需要做批处理,例如“test.bat”
标签: windows batch-file