另一个函数的参数

时间:2012-09-13 07:13:35

标签: batch-file

我尝试以下代码,但是当我添加粗体行时,它失败了

:Is_Error_file_empty
for /f "tokens=1,3" %%x in (%TMPLog%) do (
    if "%%x"=="ERROR" SET err=TRUE(
    **call :a %1**
)

:a
if %1 neq "c" (
    echo echo ERROR: you had an error with copying files,please see in error.log for details.
)

1 个答案:

答案 0 :(得分:1)

语法根本就存在一些问题 括号不平衡,放在错误的位置 也许你想在%1中使用call :a %1,但我看不出它来自何处 也许你想使用第二个令牌? EXIT/b应放在代码块之后,否则还会执行以下代码。

此代码可作为进一步测试的基础。

:Is_Error_file_empty
for /f "tokens=1,3" %%x in (%TMPLog%) do (
    if "%%x"=="ERROR" (
        SET err=TRUE
        call :errorInfo %%y
    )
)
exit /b

:errorInfo
if "%1" neq "c" (
    echo echo ERROR: you had an error with copying files,please see in error.log for details.
)
exit /b