xcopy /Y /R "%VS140COMNTOOLS%..\IDE\CommonExtensions\Platform\DiagnosticsHub\x86\dbghelp.dll" binaries\msvcr\
The command line above fails with the error message below in 4 cases:
File not found - dbghelp.dll
0 File(s) copied
The folder path assigned to environment variable VS140COMNTOOLS does not end with a backslash.
This possible cause of error is obviously not the case here as echo %VS140COMNTOOLS% prints the folder path with a backslash at end.
The environment variable has the string value:
%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\Tools\
But this is not the case here as otherwise echo %VS140COMNTOOLS% would print that string.
The folder path assigned to environment variable VS140COMNTOOLS has 1 or more trailing spaces/tabs.
The folder path assigned to environment variable VS140COMNTOOLS starts with 1 or more leading spaces/tabs.
For the second and third cause of error it would help to run echo "%VS140COMNTOOLS%" and look if the output is:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\ "
or
" C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\"
Using syntax set variable=value can easily result in getting the value with trailing spaces/tabs assigned to the environment variable resulting on usage in errors like this one. The solution is using set "variable=value" as explained in detail in answer on Why is no string output with 'echo %var%' after using 'set var = text' on command line?
For completeness a definition of the environment variable VS140COMNTOOLS with the command line
set VS140COMNTOOLS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\"
with first double quote after equal sign instead of left to variable name and no trailing spaces/tabs would result in execution the command line:
xcopy /Y /R ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\"..\IDE\CommonExtensions\Platform\DiagnosticsHub\x86\dbghelp.dll" binaries\msvcr\
But this command line would result in the error message:
Invalid number of parameters
So already double quoted folder path can be also excluded as possible cause of the error.
BTW: The help of xcopy output by running in a command prompt window xcopy /? lists the optional parameters after source and target parameters. It is of course possible to specify first /R /Y and then source file and target folder, but it is in general advisable to use the syntax as suggested by help of command.