简体   繁体   English

windows批处理文件系统找不到指定的批处理标签-退出

[英]windows batch file The system cannot find the batch label specified-exit

I'm having a problem with a DOS batch file and labels.我的 DOS 批处理文件和标签有问题。 I keep getting this error: there are two batch files(QQ.bat and Calling.bat) in the same folder.我不断收到此错误:同一文件夹中有两个批处理文件(QQ.bat 和 Calling.bat)。

the code of QQ.bat: QQ.bat代码:

@echo off
set /a i=0
:loop
set /a i=i+1
echo %i%
c:
cd \Users
cd mytool
cd QQ
cd Bin
QQ.exe
if "%i%"=="2" goto exit 
goto loop

The code of Calling.bat: Calling.bat的代码:

@echo off
set/a i=0
:loop
set/a i=i+1
start /b cmd /c QQ.bat
if "%i%"=="4"  exit
goto loop
pause

the console's output "The system cannot find the batch label specified -exit",and excute severl QQ.exe by random and the amount is not correct ,while my excepted result is that there will be excute 8 QQ.exe simultaneously.控制台输出“系统找不到指定的批处理标签-退出”,随机执行severl QQ.exe,数量不正确,而我排除的结果是同时执行8个QQ.exe。

The console shows an error because GOTO statement is trying to jump to a label which doesn't exist.控制台显示错误,因为GOTO语句试图跳转到不存在的标签。

From what I can understand by the use of goto exit in your script is that you want the script to exit at that point.从我在脚本中使用 goto exit 可以理解的是,您希望脚本在该点退出。 For that use:对于这种用途:

GOTO:EOF instead of goto exit . GOTO:EOF而不是goto exit

This should do what your code is doing: QQ.exe is launched 8 times - but your code is reusing the %i% variable so you may not need it 8 times.这应该完成您的代码正在执行的操作: QQ.exe启动了8次 - 但您的代码正在重用%i%变量,因此您可能不需要它 8 次。

@echo off
for /L %%a in (1,1,8) do start "" /d "c:\Users\mytool\QQ\Bin" "QQ.exe"

You have correctly defined labels, but incorrectly interpreted goto syntax.您已正确定义标签,但错误地解释了 goto 语法。 Use "goto :exit" instead.改用“goto :exit”。 You can find help on batch command by executing it with "/?"您可以通过使用“/?”执行批处理命令来找到有关批处理命令的帮助。 in command line (like "goto /?" )在命令行中(如 "goto /?" )

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows 批处理文件 - 系统找不到指定的批处理标签 - Windows batch file - The system cannot find the batch label specified 系统找不到指定的批次标签 - The system cannot find the batch label specified 系统找不到指定的路径-批处理文件 - The system cannot find the path specified - Batch file “ yarn resourcemanager”产生“系统找不到指定的批次标签-resourcemanager” - “yarn resourcemanager” yields “The system cannot find the batch label specified - resourcemanager” Windows批处理文件中来自远程存储库的svn head修订-系统找不到指定的文件 - svn head revision from a remote repository in windows batch file - the system cannot find the file specified Windows 批处理脚本“系统找不到指定的文件。” 文件名中有感叹号? - Windows batch script "The system cannot find the file specified." with exclamation in filenames? 批处理文件中出现意外的“系统无法找到指定的驱动器。” - Unexpected “The system cannot find the drive specified.” in batch file 即使label存在,为什么会抛出“系统找不到指定的批次label”? - Why "The system cannot find the batch label specified" is thrown even if label exists? 批处理-系统找不到指定的文件 - Batch - system can not find the file specified 运行Babun,出现错误“系统找不到指定的批次标签-CHECKTARGET” - Running Babun, Getting error “The system cannot find the batch label specified - CHECKTARGET”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM