How to combine wildcards and spaces (quotes) in an Windows command?

Posted by Jan Fabry on Super User See other posts from Super User or by Jan Fabry
Published on 2010-06-02T10:14:07Z Indexed on 2010/06/02 10:24 UTC
Read the original article Hit count: 298

Filed under:
|
|
|

I want to remove directories of the following format:

C:\Program Files\FogBugz\Plugins\cache\[email protected]_NN

NN is a number, so I want to use a wildcard (this is part of a post-build step in Visual Studio). The problem is that I need to combine quotes around the path name (for the space in Program Files) with a wildcard to match the end of the path. I already found out that rd is the remove command that accepts wildcards, but where do I put the quotes? I have tried no ending quote (works for dir), ...example.com*", ...example.com"*, ...example.com_??", ...cache\"[email protected]*, ...cache"\[email protected]*, but none of them work.

(How many commands to remove a file/directory are there in Windows anyway? And why do they all differ in capabilities?)

© Super User or respective owner

Related posts about Windows

Related posts about command-line