Windows CMDInteractive Lab
File Managementdir

DIR Attributes (/A) Explained for Windows CMD

Learn how DIR /A works in Windows Command Prompt, including hidden, system, read-only, and directory filters with practical command examples.

Rojan Acharya··Updated Apr 17, 2026
Share

In DIR, the /A switch means attribute filtering. It lets you list files and folders based on attributes like hidden (H), system (S), read-only (R), and directory (D). This is essential when default listings do not show what you expect.

What Does /A Mean in DIR?

/A tells DIR to filter output by attributes. You can include one or more attribute letters, and you can negate with -.

Syntax

DIR /A[:attributes]
AttributeMeaningExample
HHiddenDIR /A:H
SSystemDIR /A:S
RRead-onlyDIR /A:R
DDirectoriesDIR /A:D
-DNot directories (files only)DIR /A:-D

Examples

DIR /A
DIR /A:H
DIR /A:HS
DIR /A:D
DIR /A:-D
DIR /A:H /O:S

Common Use Cases

  • Display hidden files in user profiles.
  • List only directories for structure audits.
  • Isolate read-only files before bulk edits.
  • Review system files during troubleshooting.

Tips and Best Practices

  • Use /A with /O for focused and sorted output.
  • Use /A:-D when file-only results matter.
  • Combine with /S to scan entire trees.

Troubleshooting Common Issues

Missing hidden files

Use /A:H or /A.

Unexpected directories in output

Switch to /A:-D.

Too broad results

Add file pattern filters.

Access denied on system paths

Run elevated CMD.

Related Commands

Frequently Asked Questions

What does DIR /A show?

All entries including hidden/system items.

How do I show hidden files only?

Use DIR /A:H.

How do I list only folders?

Use DIR /A:D.

How do I list files only?

Use DIR /A:-D.

Can I combine attributes?

Yes, e.g., DIR /A:HS.

Can I sort while filtering attributes?

Yes, e.g., DIR /A:H /O:S.

Does this work recursively?

Yes, add /S.

Is this available in all Windows versions?

Yes, DIR /A is widely supported.

Quick Reference Card

CommandPurpose
DIR /AAll attributes
DIR /A:HHidden entries
DIR /A:SSystem entries
DIR /A:DDirectories only
DIR /A:-DFiles only

CTA

Practice attribute filters in the simulator and explore related commands in the reference.

Summary

DIR /A is the attribute filter that unlocks hidden and targeted listing workflows in CMD. Combine it with sort and recursion switches for complete control.