首页 > 解决方案 > Azure DevOps 服务器上出现“输入行太长”的批处理命令 vcvarsall.bat 错误

问题描述

我在 Azure DevOps 服务器管道上运行批处理文件作为批处理脚本任务。此批处理文件在内部调用英特尔 Parallel Studio 编译器 2019 更新 3,如下所示:

if %ERRORLEVEL% NEQ 0 (
    call "%ICPP_COMPILER19%bin\compilervars.bat" intel64 vs2017
)

然后调用构建文件。

最近,我观察到这个命令抛出错误:

##[command]C:\build_dir\test.bat

Intel(R) MPI Library 2019 Update 3 for Windows* Target Build Environment for Intel(R) 64 applications
Copyright 2007-2019 Intel Corporation.

Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
Intel(R) Compiler 19.0 Update 3 (package 203)
 
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0.26228.57
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
The input line is too long.
The syntax of the command is incorrect.

这是什么错误,为什么是现在?我看到了很多与此相关的问题,但我找不到与我的查询相关的答案。

标签: windowsbatch-fileazure-devops

解决方案


The input line is too long.通常发生在百分比扩展后,结果行长于 8191 个字符。

在您的情况下,它可能是路径/includedir 变量在附加某些内容后溢出。
此类问题的原因可能是批处理文件的递归或多次调用。
然后您应该会看到多次附加相同的路径。

另一个问题可能是您的项目路径很长,例如 C:\my insane Projects\are nested\into a structure\that is much too deep\...<2000 characters later>\myProject

检查你的PATH变量,有时重复很多次很荒谬。

要找到您的问题,请添加一些echo #123compilervars.bat找到确切的行。
然后分析有问题的变量。


推荐阅读