How to Use the dir Command in Windows

2022-Aug-26

Home

email Feedback About This Page

howtogeek.com: How to Use the DIR Command in Windows by Brady Gavin, 2022-Jul-25

The dir command is a powerful Windows Command Prompt function that lists all files and subdirectories contained in a specific directory. It has options that unlock powerful functionality.


How to Open the Command Prompt Window

  1. Click the Start Menu - lower left corner.

  2. After the menu opens, scroll down to the Windows System folder.

  3. Click the Windows System folder to open its submenu and you see the Command Prompt option.

  4. The Command Prompt window opens and you see a simple window showing what is called the Command Prompt which in my case is  c:\users\eugene> .

    In your case you'll see  c:\users\your_name:

  5. Type  dir  and hit the  Enter  key and you see the default listing:

  6. Done.

How to Change to Another Folder/Directory From the Default Directory

  1. Open  File Explorer  and go to the folder where you want to examine the files.

    For this example I will use:
     This PC > Documents > ideas > book 

  2. Click the little yellow box at which the orange arrow is pointing:

  3. You see:
     This PC > Documents > ideas > books 
    change to:
     C:\Users\eugene\Documents\ideas\books 
    with a white font on blue background - it's highlighted.

  4. Right-click on  C:\Users\eugene\Documents\ideas\books  to see a menu open with the third option  Copy . Click  Copy .

  5. Click down in the file list to see  This PC > Documents > ideas > books  reappear:

  6. Go back to the Command Prompt window.

    At the Command Prompt  c:\users\eugene> :
    1. type  cd 
    2. type  1 space 
    3. do a right-click
    4. and  C:\Users\eugene\Documents\ideas\books  appears
    5. hit the  Enter  key

  7. And the Command Prompt  c:\users\eugene> 
    changes to:
     C:\Users\eugene\Documents\ideas\books 

  8. At the Command Prompt  C:\Users\eugene\Documents\ideas\books  type:
     dir 
    and hit the  Enter  key to see the default directory listing:

  9. Done.