为什么choice.com在批处理文件中创建无限循环? [英] Why does choice.com creates an infinite loop in a Batch file?

查看:111
本文介绍了为什么choice.com在批处理文件中创建无限循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我从此choice.com 命令/RESKIT/SUPPDISK/CHOICE.COM rel = nofollow title = FTP> FTP链接以在Windows XP上使用它。从命令行可以正常运行,如在本例中所示:

Yesterday, I have downloaded the choice.com command from this FTP link to use it on Windows XP. From command line it works correctly, as you can see in this example:


C:\DOCUME〜1\Rodolfo> choice / c:12345选择输出:

选择输出:[1,2,3,4,5]? 5

C:\DOCUME〜1\Rodolfo> echo%ERRORLEVEL%

5

C:\DOCUME~1\Rodolfo>choice /c:12345 "Choose the output:"
Choose the output:[1,2,3,4,5]? 5
C:\DOCUME~1\Rodolfo>echo %ERRORLEVEL%
5

我也尝试在批处理文件中使用它,但是,尽管语法似乎是正确的,但它创建了一个无限循环,如以下引号所示:

I try to use it also into a batch file but, although the syntax seems to be correct, it creates an infinite loop, as shown in the following quotation:

按任意键继续...
按任意键继续...
按任意键继续。.

Press any key to continue...
Press any key to continue...
Press any key to continue..

以下是批处理文件中的说明:

Here are the instructions inside the Batch file:


@echo off
pause < br> choice / c:12345选择输出:
如果%ERRORLEVEL%
EQU 1 echo您选择了1
if%ERRORLEVEL%EQU 2 echo您选择了
2 < br> if%ERRORLEVEL%EQU 3 echo您已选择3
if%ERRORLEVEL%
EQU 4 echo您已选择4
if%ERRORLEVEL%EQU 5 echo您已选择
5 < br> pause

@echo off
pause
choice /c:12345 "Choose your output:"
if %ERRORLEVEL% EQU 1 echo You have chosen 1
if %ERRORLEVEL% EQU 2 echo You have chosen 2
if %ERRORLEVEL% EQU 3 echo You have chosen 3
if %ERRORLEVEL% EQU 4 echo You have chosen 4
if %ERRORLEVEL% EQU 5 echo You have chosen 5
pause

那么,为什么此命令在批处理文件中似乎不能正常工作,尽管它在命令行中可以正常工作?

So, why does this command seem to not work correctly in Batch files although it works fine from command line?

推荐答案

不要调用您的批处理文件 choice ,因为它会循环执行。

Don't call your batch file choice as it executes itself in a loop.

这篇关于为什么choice.com在批处理文件中创建无限循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆