DIR Command in DOS

Displays a list of files and subdirectories in a directory.SYNTAXDIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]] [/O[[:]sortorder]] [/S] [/B] [/L] [/V]

  • [drive:][path][filename] Specifies drive, directory, and/or files to list.
  • /P Pauses after each screenful of information.
  • /W Uses wide list format.
  • /A displays only files with these attributes:
        D Directories
        R Read-only files
        H Hidden files
        A Files ready for archiving
        S System files
      – Prefix meaning not: can be added to above attributes
  • /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 (earliest first)
        G Group directories first
        A By Last Access Date (earliest first)
      – Prefix to reverse order: put in front of above
  • /S Displays files in specified directory and all subdirectories.
  • /B Uses bare format (no heading information or summary).
  • /L Uses lowercase.
  • /V Verbose mode.
dir – Lists all files and directories in the directory that you are currently in.
dir /s – Lists the files in the directory that you are in and all sub directories after that directory.
dir /p – If the directory has a lot of files and you cannot read all the files you can use this command and it will display all files one page at a time.
dir /w – Lists just the files and directories, going horizontal, and taking as little as space needed.
dir /a:-s – This would list all the files that aren’t system files in the current directory.

Leave a Reply