DIR: Displays a list of files and subdirectories in a directory.


 


... The examples for the command "DIR"
... "DIR" Excerpt from Microsoft Windows Help
... Important information, tips for the "DIR" command

The command: "DIR" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available

The examples for the command "DIR"

The `DIR` command in Windows Command Prompt is used to display information about files and directories. Here are some examples with comments: Example 1: Show contents of current directory:

YOU

Description: This command displays the contents of the current directory, including files and subdirectories. Example 2: Show contents of a specific directory:

DIR C:\Path\Destination directory

Description: The contents of the directory "C:\Path\Target directory" are displayed here. Example 3: Show content with details:

YOU /A /W

Description: This command displays the contents of the current directory, including details such as file size and modification date. `/A` also shows hidden files, and `/W` shows the information in a wider column view. Example 4: Display content with subdirectories (recursively):

YOU /S

Description: Here the contents of the current directory including all subdirectories are displayed recursively. Example 5: Show only file names, no details:

YOU /B

Description: This command only displays the file names in the current directory, without details such as size and date. Useful in scripts or if you're just interested in the filenames. Example 6: Show content sorted by date:

YOU /OD

Description: The contents of the current directory are displayed here, sorted by date. Example 7: Show only directories:

YOU /AD

Description: This command only displays the directories in the current directory, not the files. Example 8: Save content to a text file:

DIR > directory list.txt

Description: This command saves the contents of the current directory to a text file named "directorylist.txt". Example 9: Show help:

YOU /?

Description: This command displays help and information about the available options for the `DIR` command. The `DIR` command provides a variety of options to customize the content displayed. You can access the help using `DIR /?` for more details. Note that some options, such as `/S` or `/A`, can significantly affect the output.

"DIR" Excerpt from Microsoft Windows Help

Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.

C:\\WINDOWS>

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

  [drive:][path][filename]
              Specifies drive, directory, and/or files to list.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
               H  Hidden files               A  Files ready for archiving
               S  System files               -  Prefix meaning not
  /B          Uses bare format (no heading information or summary).
  /C          Display the thousand separator in file sizes.  This is the
              default.  Use /-C to disable display of separator.
  /D          Same as wide but files are list sorted by column.
  /L          Uses lowercase.
  /N          New long list format where filenames are on the far right.
  /O          List by files in sorted order.
  sortorder    N  By name (alphabetic)       S  By size (smallest first)
               E  By extension (alphabetic)  D  By date/time (oldest first)
               G  Group directories first    -  Prefix to reverse order
  /P          Pauses after each screenful of information.
  /Q          Display the owner of the file.
  /S          Displays files in specified directory and all subdirectories.
  /T          Controls which time field displayed or used for sorting
  timefield   C  Creation
              A  Last Access
              W  Last Written
  /W          Uses wide list format.
  /X          This displays the short names generated for non-8dot3 file
              names.  The format is that of /N with the short name inserted
              before the long name. If no short name is present, blanks are
              displayed in its place.
  /4          Displays four-digit years

Switches may be preset in the DIRCMD environment variable.  Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.

Important information, tips for the "DIR" command

There are a few important points to note when using the `DIR` command in the Windows Command Prompt: 1. Wildcards: You can use wildcards ( and ?) to display files or directories in a specific pattern. For example, `DIR .txt` displays all text files in the current directory.

    DIR *.txt
    
2. Directory structure: If you use `/S`, the command will display the contents of all subdirectories recursively.

    YOU /S
    
3. Show hidden files: You can use `/A` to show hidden files. `/A:H` only shows hidden files.

    YOU /A:H
    
4. Show Details: `/W` displays files and directories in a wider column view, while `/O` changes the sort order. For example, `DIR /O:D` shows the files sorted by date.

    YOU /W
    YOU /O:D
    
5. Show filenames only: `/B` displays only the filenames, without any additional information.

    YOU /B
    
6. File Attributes: `/A` can also be used to select files based on attributes (e.g., `/A:-R` only displays files that are not read-only).

    DIR /A:-R
    
7. Redirect output to a file: You can redirect the output of `DIR` to a file for storage or further processing.

    DIR > directory list.txt
    
8. Show Help: `DIR /?` displays help and information about the available options for the `DIR` command. Note that the `DIR` command allows viewing files and directories in a directory. If you want to perform more specific operations such as copying, deleting, or moving, you could use additional commands such as `COPY`, `DEL`, or `MOVE`.


Deutsch
English
Español
Français
Italiano
日本語 (Nihongo)
한국어 (Hangugeo)
汉语 (Hànyǔ)
Türkçe
Português
Português
Svenska
Norsk
Dansk
Suomi
Nederlands
Polski









Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



The command DIR - Displays a list of files and subdirectories in a directory.

HTTP: ... console92.000000ko0.000000index.htm/en/021.htm
0.124
18176
Serial number of the hard disk under Windows 11, 10, ... via command prompt!
Questions about Brightness.Manager.OK for Windows?
Copy only the directory structure and not the files!
Excel, Word und Office im Start-Menü unter MS Windows alle OS?
Where can I download the free Avira AntiVir Personal?
Set maximum password age / expiration date via Windows PowerShell!
Wo bitte werden die importierten Bookmarks abgespeichert?
Was ist ein Kontotyp unter Windows 11, 10, usw.?
Information about a specific user account via cmd.exe or PowerShell!
RGB Pixel to Negative!



(0)