Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just wondering how Windows determines file ordering when running a "dir" command (without any arguments) in a command prompt.

I know you can explicitly specify an order, but just curious how ordering works when no parameters are used. (I have a home stereo which can read songs from a usb drive, and it seems to play songs in the same order as that seen when I run a "dir" command on a windows XP command prompt. If I can figure out how the ordering works in a vanilla "dir" command, I might be able to control the play order of the songs on the stereo by changing certain attributes of the files).

share|improve this question

migrated from Sep 30 '12 at 19:01

This question came from our site for professional and enthusiast programmers.

Which version of Windows? What filesystem on your USB drive. My dir lists in alphabetical order. – David Heffernan Sep 30 '12 at 14:49
@David: Same for me in my Win7Home – abatishchev Sep 30 '12 at 17:03
@DavidHeffernan: Windows XP. USB is FAT formatted. – Moe Sisko Oct 1 '12 at 4:06
up vote 2 down vote accepted

dir (without arguments) command always shows files/dirs unsorted, in other words - in same order, as files/dirs are located on disk. NTFS file system "sorts" files/dirs internally (simplifying).

Thought, you may copy files one-by-one to achieve preferred sorting on your player.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.