Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a batch file within which I'm using the following pattern:


I want to select all files with the extension .res, but this pattern is matching files with an extension of .resources also.

In other words, it acts like I'm specifying *.res* but I'm not.

Is there a way I can prevent the command line from evaluating short 8.3 filenames?

share|improve this question
There is a registry option to disable this globally. – Hello71 Aug 23 '10 at 21:27
I found a way to disable the generation of short file names: Is this what you are referring to? It doesn't appear to affect existing short file names, however. – Avalanchis Aug 24 '10 at 14:30
Related: DEL *1.* deletes all files in folder – user4098326 Mar 6 '15 at 0:24
up vote 6 down vote accepted

You'll have to iterate manually and exclude those files that don't match, for example like this:

for %%f in (*.res) do if [%%~xf]==[.res] (
    rem do something with %%f here
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .