This been killing me... Since I've changed to Windows 8 I cannot run post build events batch or macros. I've been trying to do xcopy and run some bat files (with xcopy) without success. They always exit with code 1 or 4.

If i use the full path lets say: xcopy "c:\folder1\" "d:\folder2\"

everything works fine.

But if i try to use macros or run .bat files "c:\file1.bat" or $(SolutionDir)Copy$(ProjectName).bat

it doesn't work.

I've also tried to call it with cmd and call cmd. The Batch files run fine in command-line, and other people have been running the projects like this without problems.

I'm using visual studio 2012 (as Administrator) and team foundation.

  • What operating system were you using prior to Windows 8 for builds? Did you make any changes to the builds when you upgraded (Not including the changes you made to try and fix this)? – Taegost Aug 9 '13 at 18:50
  • Windows 7. I found out a mistake i've done with the xcopy. It seems my directory had a space in it and somehow, in my many tries, i miss placing the " with the correct macro. And after some assistance we found out that the bat are being executed but they are crashing. The problem seems to be in the source path. But how this works for everyone else and doesn't work for me it remains unknown. I need to do some more tests. Sorry for all confusion, believe me or not I've spend 2 days trying to fix these problems. and they are not fixed yet. thanks for your support. I will post more after s tests – Navy Seal Aug 9 '13 at 22:16

Seems both problems were in the paths. the xcopy i was trying didn't worked because it had some spaces, all I had to do was to add ""

the xcopys inside the batch file were not providing the correct source path. I found out that my college had been messing around with the my paths in my pc only...

About the batch running in cmd line and not running well in post-build... I guess the program itself might have been executing the Batch from a different path changing everything...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.