1

I had a batch command that copies multiple files from source to destination

for %I in ( C:\Source\abc.txt C:\Source\cba.txt) do copy %I C:\Destination

if we give the command in buildevent->prebuild event ->commandline of visual studio 2013

Its throwing me the error

error MSB3073: The command "for %I in ( C:\Source\abc.txt C:\Source\cba.txt) do xcopy %I C:\Destination :VCEnd" exited with code 255.

If we run the command in command prompt its successfully copied.

Why this is throwing the error in vs 2013 ?

Thanks Phani

1 Answers1

0

Issue

From a quick search around, it would seem that error code 255 means that it is failing to find the file.

ERROR_EA_LIST_INCONSISTENT 255 (0xFF) The extended attributes are inconsistent.

Resolution

Try using absolute paths "%~fI" in the command and the flag /Y to prevent copy prompts.

for %I in ("C:\Source\abc.txt" "C:\Source\cba.txt") do xcopy "%~fI" "C:\Destination" /Y

May also be experiencing file or directory prompt which can be resolved with echo d |

for %I in ("C:\Source\abc.txt" "C:\Source\cba.txt") do echo d | xcopy "%~fI" "C:\Destination" /Y
Community
  • 1
  • 1
David Ruhmann
  • 11,064
  • 4
  • 37
  • 47
  • Still facing the same error ....but am able to run the command through command line..Is it any problem with my visual studio 2013? – user3253682 Feb 26 '14 at 14:23
  • According to MSDN: [`Because the '%' character is reserved by MSBuild, if you specify an environment variable replace each % escape character with the %25 hexadecimal escape sequence. For example, replace %WINDIR% with %25WINDIR%25. MSBuild replaces each %25 sequence with the % character before it accesses the environment variable.`](http://msdn.microsoft.com/en-us/library/h7dhf0ty.aspx) try `for %25I in ("C:\Source\abc.txt" "C:\Source\cba.txt") do echo d | xcopy "%25~fI" "C:\Destination" /Y` If that does not work, `for` loops may just not work unless in a batch file for visual studio. – David Ruhmann Feb 26 '14 at 15:16