当我在Windows命令提示符中逐个运行以下命令时,它们工作正常.
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""
cd C:\\Program Files (x86)\\Jenkins\\jobs\\gdal_win32_develop\\workspace\\codes\\deps\\gdal\\gdal_1.8_rtc
nmake -f makefile.vc clean
nmake -f makefile.vc
Run Code Online (Sandbox Code Playgroud)
当我将它们写入一个bat文件并尝试在Windows命令提示符下执行bat文件时,它只输出第一个命令,左边三个命令不执行.
这该怎么做?我需要这个,因为我想在一个Jenkins构建项目中运行它.
替换%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""为
CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
Run Code Online (Sandbox Code Playgroud)
您不知道它,但在命令行中输入命令时,首先,您获得了一个新的cmd.exe实例,并在此新实例中键入了下一个命令.您将需要两个EXIT命令来退出命令提示符.
键入命令,您只需键入"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"而不是%COMSPEC% ...,但在批处理中它会破坏批处理执行,因此您必须预先添加CALL.