Change the Windows File Sort Order - gHacks Tech News

Change the Windows File Sort Order

Windows XP (Update: all client versions of Windows share this sort order) has a very confusing way of listing files in directories. Let me give you a small explanation. How would Windows XP sort the files abc1, abc101, abc4, abc401, abc8?

No, it is not like I have ordered them in the last sentence. The default order for those files would be abc1, abc4, abc8, abc101 and abc401. The reason behind this is that Windows XP considers the numbers to be just that which means that 101 is a larger number than 4 or 8.

The logical way of sorting files would be in my opinion to see numerals in those filenames as individual characters as well. This would sort the file names in a natural way like shown above. Windows 2000 has this default sort order and it is possible to enable it in Windows XP as well.

windows sort order

The setting can be edited as usual in the Windows Registry. Open the Registry editor by pressing Windows and R at the same time. This opens the run box of the system.

Type regedit and tap on the enter key afterwards. You may receive an UAC prompt if you are running Windows Vista or newer versions of the Windows operating system. If you do, accept it.

Use the folder structure on the left to navigate to the following key in the Registry:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Currentversion\Policies\Explorer

Right-click on Explorer and select New > Dword from the context menu. Name the new key NoStrCmpLogical. Double-click the key afterwards and changes its value to 1. This changes the default sort order to the Windows 2000 way. If you want to go back to the XP way of sorting files and folders in Windows explorer change it to 0 or delete the key.

new file sort

Windows 2000: abc1, abc101, abc4, abc401, abc8
Windows XP: abc1, abc4, abc8, abc101, abc401

Please note that you need to restart explorer.exe, sign out and on again, or restart the computer before the changes become visible. The trick works in all recent versions of Windows.

Summary
Change the Windows File Sort Order
Article Name
Change the Windows File Sort Order
Description
Change how Windows sorts files in Windows Explorer so that numerals are seen as individual characters instead of numbers.
Author




  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. Benóný said on November 9, 2007 at 8:54 pm
      Reply

      I’m pretty sure it’s not HKEY_LOCAL_MACHINE, but HKEY_USER\Software\Microsoft\Windows\Currentversion\Policies\Explorer

    2. Martin said on November 9, 2007 at 9:33 pm
      Reply

      USER is for the single user while MACHINE is for all users

    3. Benóný said on November 9, 2007 at 9:39 pm
      Reply

      ah, yes I see :)

    4. Benóný said on November 9, 2007 at 10:44 pm
      Reply

      hmm.. still this isn’t working for me *-) I tried LOCAL_MACHINE ,CURRENT_USER and USER and once all at the same time and it still isn’t showing any difference *-)
      btw, my pc sorts the 2000 way, maybe I XdN Tweaker or something like that is causing this.

    5. Sanctimonious Ape said on November 10, 2007 at 11:51 am
      Reply

      I can see deleting my previous comment if I had somehow been offensive, but other than perhaps causing you some minor embarrassment I cannot see how the action was justified. My comment could have been very useful to Benóný above.

      To Benóný: Martin likes to do things “The Hard Way” (TM), and so would rather go through the registry to adjust things. Granted, it is – as he has (sort of) stated elsewhere – a good way to get to learn how the system ticks, but many of us just want to fix the problem and move on. He apparently deleted a post I made here which pointed out a much simpler way to do it, but evidently he doesn’t care for freedom of speech or alternatives being provided to “His Way” (and all that implies).

      If by some miracle he manages to get over himself enough to allow this post through, then allow me to point you to M$’ PowerToys collection, which includes the essential “TweakUI” program. TweakUI allows you to adjust the sort order by going to the “Explorer” section and toggling the “Use intuitive filename sorting” checkbox. Get TweakUI here:

      http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

    6. Martin said on November 10, 2007 at 11:56 am
      Reply

      Santimonious Ape, I accidentally deleted the second comment of you belonging in this thread. It was early in the morning and I thought it was a dupe of the comment in the other post.

      I recognized later that it belonged to this one. Sorry for that but I had no way to recover it.

      Please be careful with those accusations the next time.

    7. Benóný said on November 10, 2007 at 3:18 pm
      Reply

      Thx Sanctimonious Ape ;)

    8. Tony said on August 9, 2009 at 2:41 pm
      Reply

      This worked for me. It definitely made life easier when trying to sync with my Panasonic camcorder.

    9. Sterling said on August 13, 2009 at 1:53 am
      Reply

      THANK YOU!!! I was trying to print a group of JPGs out to a pdf file in sequence

    10. lee said on December 17, 2011 at 6:07 am
      Reply

      It is not there. on my computer the only things under polices are
      NonEnum, Ratings, and System. I am using windows xp pro if that makes a difference and I was hoping to get this working but I am unable to follow these instructions.

    11. Rosco said on January 10, 2012 at 1:25 am
      Reply

      So much for intuitive sort order – files 10-test.txt and 10a-test.txt, which order would YOU sort them in? Now go check what order Windows sorts them in…

    12. Crystal said on September 4, 2014 at 6:01 pm
      Reply

      Used for Win7 64-bit… works perfectly. Thank you, thank you, thank you!

    Leave a Reply