gpt4 book ai didi

该命令的语法批量不正确?

转载 作者:行者123 更新时间:2023-12-04 06:23:10 24 4
gpt4 key购买 nike

该cmd.exe不断给我一个命令。当我运行以下代码时,该命令的语法是错误错误。它出什么问题了?

代码:

 @echo off
setlocal enabledelayedexpansion
CALL ant clean build compile

REM loop thru/Run ALL .properties file names from "ExecutionSDKTest_10.2.2" folder
:labelNextTest
FOR %%G in (C:\ExecutionSDKTest_10.2.2\*.properties) DO (
pause
Set fileName=%%~nxG
rem fileName==ENG-822.properties
set testName=!fileName:~0,7!
rem testName==ENG-822
set testNum=!fileName:~4,3!
REM testNum==822
ECHO Please Create: !testName!_Ref.properties.txt in C:\ExecutionSDKTest_10.2.2\Logs
echo Running:!fileName!
java -jar Test.jar !fileName! > Logs\!fileName!.log

set logPath="C:/ExecutionSDKTest_10.2.2/Logs/!fileName!.log"
set refLogPath="C:/ExecutionSDKTest_10.2.2/Logs/!testName!_Ref.properties.txt"
REM if Ref exists check Line by line
if EXIST !refLogPath!(
Call Perl TestProp1RefcheckLines.pl !fileName! !testName!
) else (
rem if ref does NOT exist check one important line
rem returns case number to check for
perl.exe c:\ExecutionSDKTest_10.2.2\TestProp1noRefCases.pl !testNum!
set lineCase=!ERRORLEVEL!
echo linecase is !lineCase!

rem set LineCase to one, two, three or four, depending on case number
FOR /F "tokens=*" %%B in (!logPath!) Do (
set logLine=%%B
rem check line >> : "...job status:..."
if /i "!logLine:~11,33!"=="... STATUS REPORT: ...Job status:"(
if "!lineCase!" =="1"(
if /i "!logline:~32!" == "job status: job finished_error" goto labelPass
)
if "!lineCase!"=="2" (
if /i "!logLine:~32!" == "Job status: job QUEUED" goto labelPass
)
if "!lineCase!"=="4"(
if /i "!logLine:~32!" == "job Execution Finished Successfully" goto labelPass
)
) else (
if /i "!logLine:~11,33!"=="Error initializing the connection" goto labelPass
if /i "!logLine!" == "Exception in thread ""main"" java.lang.IllegalArgumentException: timeout value is negative" goto labelPass
)
)
goto labelFail
)
)
pause

REM Test Passed or Failed
:labelFail
echo !TestName! FAILED due to the above incorrect line
goto labelNextTest

:labelPass
Echo !TestName! PASSED
goto labelNextTest

最佳答案

您缺少一些关键的空格。在这些行中:

if EXIST !refLogPath!(

if /i "!logLine:~11,33!"=="... STATUS REPORT: ...Job status:"(

if "!lineCase!" =="1"(

if "!lineCase!"=="4"(

括号 (之前必须有一个空格!

是的,批处理脚本很难调试。但是实际上,该脚本看起来更漂亮(缩进正确,等等。)。

关于该命令的语法批量不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11368198/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com