Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute windows batch command from Jenkins fails but runs fine in cmd.exe

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: 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.

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

Any help would be appreciated.

like image 655
Chris Avatar asked Jun 08 '12 16:06

Chris


1 Answers

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.

enter image description here

like image 58
adarshr Avatar answered Oct 09 '22 01:10

adarshr