Change the sort order for files and folders whose names contain numerals

This article was previously published under Q319827 at Microsoft Support site. © Microsoft.

Original Title: The sort order for files and folders whose names contain numerals is different in Windows Vista, Windows XP, and Windows Server 2003 than it is in Windows 2000.

Information in this article also applies to Windows 10 and 11.

Summary

This article discusses the sort order that is used by Windows Vista, Windows XP, and Windows Server 2003 for files and folders whose names contain numerals. This article also contains information about how the newer sort order differs from the sort order in Windows 2000, and describes how you can modify sort order behavior in Windows Vista, Windows XP, and Windows Server 2003.

The sort order that is used by Windows Vista, Windows XP, and Windows Server 2003 for files and folders whose names contain numerals differs from the sort order that is used by Windows 2000. The following example shows the difference.

Windows Vista, Windows XP, and Windows Server 2003

  • Ie4_01
  • Ie4_128
  • Ie5
  • Ie6
  • Ie401sp2
  • Ie501sp2

Windows 2000

  • Ie4_01
  • Ie4_128
  • Ie401sp2
  • Ie5
  • Ie501sp2
  • Ie6

By default, the newer sort order considers strings in file and folder names as numeric content, not text. Numerals in folder and file names are sorted according to their numeric value.

In this example, 401 is a numerically higher value than 6. Therefore, the Ie401sp2 folder is listed after the Ie6 folder when you sort the folders by name in ascending order. In the following example, note how the following files, whose names contain numerals, are sorted.

Windows Vista, Windows XP, and Windows Server 2003

  • 5.txt
  • 11.txt
  • 88.txt

Windows 2000

  • 11.txt
  • 5.txt
  • 88.txt

To configure a policy setting to modify sort order in Windows Vista, Windows XP, or Windows Server 2003

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:



322756 How to back up and restore the registry in Windows

You can configure a policy setting to use either the newer sort order or the sort order that is used in Windows 2000. The policy setting is stored in the following registry entries:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer\NoStrCmpLogical
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer\NoStrCmpLogical

To obtain this functionality in Windows XP, you must install the latest service pack for Windows XP. This functionality was first available in Windows XP Service Pack 1 (SP1). For more information about how to obtain the latest service pack for Windows XP, click the following article number to view the article in the Microsoft Knowledge Base:

322389 How to obtain the latest Windows XP service pack

After you install Windows XP Service Pack 1 or a later service pack, create the NoStrCmpLogical registry entry, and configure the policy. To do this, follow these steps:

  1. Click Start, click Run, type regedit, and then click OK.
  2. Use one of the following methods, as appropriate for your situation:
    • To configure the policy for all users of the computer, locate and then click the following registry key:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer
    • To configure the policy for the current user, locate and then click the following registry key:
      HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer
  3. On the Edit menu, point to New, and then click DWORD Value
  4. Type NoStrCmpLogical, and then press ENTER.
  5. On the Edit menu, click Modify.
  6. To set the sort order that you want to use for files and folders whose names contain numerals, use one of the following methods, as appropriate for your situation:
    • To configure Windows XP or Windows Server 2003 to use the method that Windows 2000 uses for sorting files and folders, in the Value data box, type 1, and the click OK.
    • To configure the default Windows XP or Windows Server 2003 method for sorting files and folders, in the Value data box, type 0, and then click OK.
  7. Note When the
    NoStrCmpLogical
    value does not exist or when it is set to 0 (zero), the default Windows XP sort order is used.

  8. Exit Registry Editor, and then restart the computer.

— End of the Microsoft article —

Editor’s note: As said earlier, information in this article and the registry setting NoStrCmpLogical apply to Windows 10/11, as well. You may have to log off and log back in for the change to take effect.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Reply