I have windows based Jenkins host and local folder like this:
"c:\Archive\JenkinsBuilds"
When I'm using shell exec to copy build to that folder (all the content of Release folder) I'm getting an error. The issue is because Jenkins adds single quotes automatically and shell exec expectes double quotes only:
I defined env variables:
FINAL_PACKAGE = My-Project\bin\Release
BUILDS_DEST = c:\Archive\JenkinsBuilds\My-Project\$BUILD_NUMBER
and shell exec:
xcopy /i /f /v $FINAL_PACKAGE $BUILDS_DEST
And during execution I see in logs:
xcopy /i /f /v 'My-Project\bin\Release' 'c:\Archive\JenkinsBuilds\My-Project\17'
How to force Jenkins to use double quotes. If I specify them manually Jenkins adds single quotes in any case what generates the same error:
"Invalid number of parameters"
Thanks to @Cole9350 for advise. On windows it is better to use windows batch command
And variables usage will be different:
xcopy /i /f /v "%FINAL_PACKAGE%" "%BUILDS_DEST%"