Cadzow Knowledgebase

Normal view

Windows Explorer Sorts Files In Unusual Way

Windows XP and above apply a new sorting algorithm when displaying files in Windows Explorer, which is that any filenames starting with numbers are sorted numerically rather than alphabetically.

For example, Explorer will sort the files 1111.txt, 112.txt, 222.txt, 33.txt as:

  • 33.txt

  • 112.txt

  • 222.txt

  • 1111.txt

… because 33 < 112 < 222 < 1,111.

However, alphabetically, the correct sorting is:

  • 1111.txt

  • 112.txt

  • 222.txt

  • 33.txt

because “1” < “2” < “3”.

This sorting only affects Windows Explorer; a directory listing from a command prompt lists the files alphabetically.

To revert the sorting to the classic, alphabetical sorting:

  1. Open an elevated command prompt

  2. Type (or copy and paste):

    reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoStrCmpLogical /t REG_DWORD /d 1 /f

  3. Log out and log back in.

Notes

  • Requires Windows XP Service Pack 1 or better.

  • Requires elevated permissions despite being set in the “current user” hive due to permissions on the Policies subkey.

  • Setting can be applied to all users by using the HKLM (local machine) hive rather than HKCU (current user).

  • Setting can also be set via Group Policy (gpedit.msc) under User Configuration, Administrative Templates, Windows Components, Windows Explorer by setting Turn off numerical sorting in Windows Explorer to Enabled.

Copyright © 1996-2019 Cadzow TECH Pty. Ltd. All rights reserved.
Information and prices contained in this website may change without notice. Terms of use.

Question/comment about this page? Please email webguru@cadzow.com.au