执行Windows批处理命令从Jenkins失败,但在cmd.exe运行良好 [英] Execute windows batch command from Jenkins fails but runs fine in cmd.exe

查看:11142
本文介绍了执行Windows批处理命令从Jenkins失败,但在cmd.exe运行良好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在MSbuild后在jenkins中运行此命令

I am trying to run this command in jenkins after a MSbuild

xcopy "C:\Program Files (x86)\Jenkins\workspace\trunk\Projects\results\results\obj\Debug\Package\PackageTmp" "Y:\Extraction_Zone\Jenkins\" /E 

Y:是映射的网络驱动器。这在cmd.exe运行良好,但当试图运行它在Jenkins,我得到的错误无效的驱动器规格

Y: is a mapped network drive. This runs fine in cmd.exe but when trying to run it in Jenkins, I am getting the error Invalid drive specification.

以下是jenkins的输出:

Here is the output from jenkins:

Time Elapsed 00:00:04.03
[trunk] $ cmd /c call C:\Windows\TEMP\hudson3389873107474371072.bat

C:\Program Files (x86)\Jenkins\workspace\trunk>xcopy "C:\Program Files (x86)\Jenkins\workspace\trunk\Projects\results\results\obj\Debug\Package\PackageTmp" "Y:\Extraction_Zone\Jenkins\" /E 
Invalid drive specification
0 File(s) copied

C:\Program Files (x86)\Jenkins\workspace\trunk>exit 4 
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

推荐答案

我也有一个类似的问题。尝试授予Jenkins服务登录为此帐户,位于 services.msc 下,并确保您输入的帐户与运行<$ c时使用的帐户相同$ c> cmd.exe 。

I too had a similar issue once. Try granting the Jenkins service "Logon as This account" right under services.msc and make sure the account you type there is the same as the one you use for running cmd.exe.

这篇关于执行Windows批处理命令从Jenkins失败,但在cmd.exe运行良好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆