

You can also add “-” (minus) before any of the above options to reverse the order. So, for example, you could use the following command to sort results by time and date, with older entries appearing first: dir /OD

The /N switch used to be used to achieve this effect. dir /L Display Filename Results on the Far Rightīy default, the Command Prompt displays the names of files to the far right. The /L switch displays all names of files and folders as lowercase. When you display results this way, the Command Prompt does not show extra file information (file size and so on)-just the names of the files and directories. You can use the /D switch to display results in two columns instead of one. Why bother including it here if it’s already the default? Because if for whatever reason you don’t want to show those commas, you can use this switch along with the “-” minus sign: dir /-c In older versions, you had to use the /c switch to show those commas. In modern versions of Windows, the Command Prompt shows large numbers separated by commas (so: 25,000 instead of 25000). Type the following command to make it work: dir /b Display Using Thousands Separator Using the /b switch with the DIR command strips away all excess information, displaying only the name of the folders and files in the current directory and not attributes like file size and time stamps. It can make things a little easier to parse, but it’s entirely optional. One more tip: Instead of cramming the main switch and the letter code together the way we did in our examples, you can use a colon to separate the switch from its optional codes.

So, for example, if you don’t want to see any directories in the results, you could use this command: dir /a-d You also can add a “-” (minus) in front of any of those letter codes to specify that the DIR command does not show that kind of file.
