Batch file XCOPY cannot find existing directory

Solution 1:

As other answers suggest, using .\folder starts from the current directory, while you want the batch file's location:

XCOPY  "%~dp0folder" "O:\program\dst" /E

You could cd to the folder first, but this is more elegant IMO.