Batch file to delete *.vcproj.* e.g. code.vcproj.user1 but no *.vcproj

111 views Asked by At

how to write a batch file to delete VisualStudioUserFile (*.vcproj.*) only but not the VisualStudioProject (*.vcproj)?

1

There are 1 answers

0
Joey On

This can be run interactively in cmd:

for %x in (*.vcproj.*) do if not "%~xx"==".vcproj" del "%x"

if you want a batch file, then you need

for %%x in (*.vcproj.*) do if not "%%~xx"==".vcproj" del "%%x"

This won't delete files like blah.vcproj.vcproj, though. I don't know how likely those are in your case.