Skip navigation

JSI Tip 9770. How can I prevent the DIR and other commands from finding 4 character (or more) extensions when I search for 3 character extensions?


The default behavior of the operating system when searching on an extension is to find the everything that starts with the characters you specify.

I first documented this behavior in Windows NT Short File Extensions, but finding that tip is unlikely due to the wording that I used.

NOTE: This behavior effects all commands, like DEL and COPY, not just DIR.

When you dir *.htm, it returns .htm files and .html files.

I have scripted Win95TruncatedExtensions.bat to turn off this behavior.

The syntax for using Win95TruncatedExtensions.bat is:

Win95TruncatedExtensions

NOTE: Win95TruncatedExtensions.bat uses REG.EXE built into Windows XP and Windows Server 2003, or REG.EXE from the Windows 2000 Support Tools on the CD-ROM.

Win95TruncatedExtensions.bat contains:

@echo off
setlocal
set key=HKLM\system\currentcontrolset\control\filesystem
@echo REG ADD %key% /V Win95TruncatedExtensions /T REG_DWORD /F /D 0
REG ADD %key% /V Win95TruncatedExtensions /T REG_DWORD /F /D 0
)
endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish