How To Use CMD Files And Folders On Windows?

To use CMD (Command Prompt) and work with folders and files on Windows, follow these steps and commands:

Navigating Directories

  1. Open Command Prompt: Press Windows + R, type cmd, and press Enter.

  2. Change Directory (CD): Type cd followed by the path or folder name.

    • For the current directory's parent: cd ..
    • For user folders (e.g., Documents): cd %userprofile%\Documents
  3. View Contents (DIR): Type dir to list files and subfolders in the current directory.

    • dir /a to list all files.
    • dir /a:d to list directories.
    • dir /a:r /s to list all files and subfolders, including those that are read-only.

Working with Folders and Files

  1. Create a New Folder: Type mkdir followed by the folder name.

    • E.g., mkdir other_stuff creates a folder named "other_stuff".
  2. Rename Files and Folders (REN): Type ren or rename, followed by the folder/file name, a space, and the new name.

    • E.g., ren "Digital_Citizen_Tests" "Digital_Citizen_Final_Tests"
  3. List Files in a Directory (DIR):

    • dir lists all files in the current directory.
    • dir /a /s lists all files and subfolders, including system and hidden files.
    • dir /b > FolderList.txt creates a text file listing all files in the current directory.

Remember to replace drive letters (e.g., C:) when necessary for different volumes (drives) in Windows.

These commands are valid for Windows 11 and Windows 10 and can be adjusted for older Windows versions where needed.