1
votes

I'm using Jenkins over windows 7 and i encountered strange behavior. when im trying to copy files to working directory - represented in Jenkins by the system parameter WORKSPACE, for example like in this code:

cp -a hpdevops-discovery-demoapp-master/. $WORKSPACE/

i get the following:

  • cp -a hpdevops-discovery-demoapp-master/. 'C:\Program' Files '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/'

cp: target '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/' is not a directory

what's happening: the workspace located here: C:\Program' Files '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/

but, because of the space in the path after the word 'Files' its deviding it into 2 and treating the second part - which is just half of the path, as the target path: '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/'

i used to work with Jenkins on Linux and never had a problem like this when using the WORKSPACE system parameter. anyone run into this?

1

1 Answers

6
votes

use double quote wrap it like "$WORKSPACE"