How to delete files on the command line of Visual Studio Pre-build

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

How do you need to format the command line to get around this problem, which I get below? alt text

+45
command-line build-process visual-studio pre-build-event
Apr 20 '09 at 13:35
source share
5 answers

Try

 cd $(TargetDir) del *.tif 

As Jwenema noted, your $ (TargetDir) expands to a path containing spaces in the names of folders that violate the delete command.

+62
Apr 20 '09 at 13:41
source share

I ended up using rd /s /q "$(TargetDir)" to clean the directory. As far as I know, it works.

+23
Aug 17 '11 at 18:14
source share

Try adding quotation marks to the directory.

+13
Apr 20 '09 at 13:36
source share

You must write del "$(TargetDir)*.tif" because of spaces in the directory path.

+9
Oct 17 '11 at 21:25
source share

wmic process where name='chromedriver.exe' delete

0
Apr 20 '17 at 23:47 on
source share



All Articles