views:

364

answers:

2

I have a windows batch command in my hudson build step that is basically:

 xcopy /s *.* \\serverlocation\buildname\

The copy is failing with:

'xcopy' is not recognized as an internal or external command, operable program or batch file.

However, xcopy is usable on the command line (as is copy). What do I need to do to make hudson use xcopy?

Edit: My path is

PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Perforce;C:\Program Files\CVSNT;C:\Program Files\CVSNT\

which is probably why it works from the command line.

+1  A: 

xcopy is in your system32 directory; make sure that's in your PATH.

Chris Jester-Young
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Perforce;C:\Program Files\CVSNT;C:\Program Files\CVSNT\
mmr
Is that the PATH from Hudson, or from the command-line? Just trying to see if I'm barking up the right tree. :-)
Chris Jester-Young
good point. I'm going to just put in 'C:\windows\system32\xcopy' instead of 'xcopy' and see if that works...
mmr
aaaaannnndddd... that was the problem. Man, I feel sheepish.
mmr
+1  A: 

Something you may want to watch out for when using Xcopy with Hudson (or other build systems really) is the total length of the path of the file being copied.

In my case, I'm running into issues using xcopy to copy files that are buried many levels down in a directory structure such that when combined with Hudson's working/build path level, it (I'm assuming) exceeds the maximum allowable path length for xcopy to work with. My current work-around is to simply zip build output before copying it, but I'm looking for something a little cleaner.

Peter Bernier