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
Open Command Prompt: Press
Windows + R
, typecmd
, and press Enter.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
- For the current directory's parent:
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
Create a New Folder: Type
mkdir
followed by the folder name.- E.g.,
mkdir other_stuff
creates a folder named "other_stuff".
- E.g.,
Rename Files and Folders (REN): Type
ren
orrename
, followed by the folder/file name, a space, and the new name.- E.g.,
ren "Digital_Citizen_Tests" "Digital_Citizen_Final_Tests"
- E.g.,
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.