I have a batch file two levels up.
..\..\PostBuildEventCopy.bat $(TargetDir) $(TargetName)
This batch file copies certain files to a location mentioned in the batch file. I get the below error. It seems to me that VS is not able to find the batch file.
Error: '..\..\PostBuildEventCopy.bat' is not recognized as an internal or external command, operable program or batch file.
But when I mention the full path to the batch file, post build event goes through.
Am I missing something here? Any help appreciated.
Depending on the current directory with a relative path is never not a mistake. It is just not located where you hope it is, normally it is the build directory (bin\Debug or bin\Release). But that's a setting that can be changed so that will break your build event again.
Always specify full paths so avoid this kind of lossage. And always use "double quotes" around paths so spaces in the path name don't byte. Fix:
Click the Macros button in the Edit popup to see what ${Something} macros you can use.