6

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

*.res

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?

Avalanchis
  • 702
  • 2
  • 7
  • 17
  • 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: http://support.microsoft.com/kb/210638 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](http://superuser.com/q/370300/397839) – user4098326 Mar 06 '15 at 00:24

1 Answers1

7

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
)
Joey
  • 40,002
  • 15
  • 104
  • 126