How to delete files in Visual Studio Pre-build event command line

dance2die picture dance2die · Apr 20, 2009 · Viewed 62.6k times · Source

I am trying to delete files in my $(TargetDir) within visual studio before building a project.

How do you have to format command line to get around this problem I am getting below? alt text

Answer

Eoin Campbell picture Eoin Campbell · Apr 20, 2009

Try

cd $(TargetDir)
del *.tif

As jvenema pointed out, your $(TargetDir) is expanding into a path containing spaces in the folder names which is breaking the delete command.