Copying a file to jenkins workspace location

1.5k Views Asked by At

I need to copy one file to the workspace location of jenkins for my pipeline jenkins job. For that I need to use bat command for windows. What is the bat command to copy the file from one source location to the destination location. I have used the code like

bat '''xcopy /Y /s "<source location>"*.*"<Destination location>"'''

The above code was getting the error as file not found but i have provided the right path of the files. Can anyone please help me with this.

1

There are 1 best solutions below

2
M B On

I'm not sure what you are trying to do with the *.* but if you just want to copy a file from the source location to the destination, you should use:

bat '''xcopy /Y /s "<source location>" "<Destination location>"'''

no *.*. You will get file not found with *.*. If this doesn't fulfill your needs, then elaborate on exactly what you are trying to do here and I should be able to help.