在 TFS2015 构建中启动 .bat

launch a .bat in TFS2015 build

我在 TFS 构建期间尝试通过 .bat 文件启动服务器时遇到问题。 我通常通过 cmd window 启动服务器并且它工作正常。 当我在 TFS 构建中设置它时,我得到以下消息:

"'..\server_common.bat' is not recognized as an internal command or external, an executable or a command file". 

我还有下面一行:

"java   -Dsun.lang.ClassLoader.allowArraySyntax=true  -Xbootclasspath/a:..\..\..\lib\framework\serverjvm15.jar; -cp ..\..\..\lib\framework\fwtime.jar;" indicating a java syntax error (? I'm not skilled in java)

该批次调用其他.bat文件并设置java个VM相关环境变量

根据我的研究,这可能是权限问题,因为我使用TFS时没有管理员权限。但是,构建中的所有其他步骤都工作正常(通过命令行安装和启动应用程序,或通过命令行启动 python 脚本)。

然而,我也尝试使用相同类型的步骤启动基本脚本并且它有效。

首先,建议您按照Batch script中的教程进行操作。确保您已满足 Arguments 的要求并正确使用。如

Path

Specify the path to the .bat or .cmd script you want to run. The path must be a fully qualified path or a valid path relative to the default working directory. In Team Foundation Build, this directory is $(Build.SourcesDirectory).

还有 RDP 到您的构建代理并手动使用您的构建服务帐户 运行 如果帐户有足够的权限,server_common.bat 可以缩小范围。