返回

为什么我的错误级别没有在我的批处理脚本中列出我的回显消息?他们只是列出所有

发布时间:2022-07-01 23:31:58 211

我已经列出了一个我想用几个数字来选择的名字列表,do循环确认了这些数字。但由于某些原因,我无法将这些选定的数字与GOTO echo语句对齐。相反,他们只是把它们全部列出来?我必须承认我是新的批处理脚本,但我相信有很多专家谁可以看到我哪里出错了,请帮助我?

这里是我的代码以及在命令提示符中获得的输出

:START

setlocal EnableDelayedExpansion

@echo OFF

 

echo.  [RUN BVTS]

ECHO 1.RS_CommonDataSet

ECHO 2.RS03_PackageManager

ECHO 3.RS04_SequencerCalendars

ECHO 4.RS06_EditorTestsPerformance

ECHO 5.RS06_NewEditorTests
ECHO OFF

set /p BVTSUITE="What BVT suite do you wish to run? "
rem This lists all the BVT's that you want to run with spaces

set n=0
for %%a in (%BVTSUITE%) do (
set /A n+=1
set "BVTSUITE[!n!]=%%~a"
)

 rem List the file names

for /L %%i in (1,1,%n%) do (
echo %%i- !BVTSUITE[%%i]!
)

 
IF %errorlevel%==1 set goto 1
:1
ECHO "You have chosen number RS_CommonDataSet"

IF %errorlevel%==2 set goto 2
:2
ECHO "You have chosen number RS03_PackageManager"

IF %errorlevel%==3 set goto 3
:3
ECHO "You have chosen number RS04_SequencerCalendars"

IF %errorlevel%==4 set goto 4
:4
ECHO "You have chosen number RS06_EditorTestsPerformance"

IF %errorlevel%==5 set goto 5
:5
ECHO "You have chosen number RS06_NewEditorTests"

我在命令提示符下得到的输出是:

 [RUN BVTS]

1.RS_CommonDataSet

2.RS03_PackageManager

3.RS04_SequencerCalendars

4.RS06_EditorTestsPerformance

5.RS06_NewEditorTests

What BVT suite do you wish to run? 1 3 (I chose these numbers)

1- 1

2- 3

"You have chosen number RS_CommonDataSet"

"You have chosen number RS03_PackageManager"

"You have chosen number RS04_SequencerCalendars"

"You have chosen number RS06_EditorTestsPerformance"

"You have chosen number RS06_NewEditorTests"

正如你所看到的,我的1和3被选中了,但它不在输出中,它只是显示了整个列表?

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像
相关帖子