Windows Command Line Basics¶
Introduction¶
The Windows Command Line (Command Prompt, CMD) is a powerful tool that allows users to interact with the system using text-based commands. It provides greater control, automation capabilities, and flexibility compared to graphical user interfaces (GUIs). This tutorial covers essential Windows commands to help you efficiently navigate and manage the command line.
Navigating the File System¶
Pay Attention to Path Formatting!
Windows does not differentiate between uppercase and lowercase letters, but it uses backslashes (\
) instead of /
for paths.
Display the Current Directory¶
To check your current working directory, use:
- Displays the current working directory.
Changing Directories¶
- Navigate to a specific directory:
-
Moves to the specified directory.
-
Move up one level:
-
Moves up one directory level.
-
Return to the user directory:
- Returns to the user’s home directory.
Absolute vs. Relative Paths!
- Relative Paths:
cd Documents
changes the directory relative to the current location. - Absolute Paths:
cd C:\Windows
always goes to the same location, regardless of your current directory.
Managing Files and Folders¶
Creating Files¶
- Create an empty file:
-
Creates a new empty file.
-
Create a file with content:
- Creates a new file and writes "Hello World" into it.
Viewing Files¶
- Display the contents of a file:
- Displays the content of the specified file.
Creating Folders¶
-
Creates a new folder with the specified name.
-
Create multiple nested directories at once:
- Creates a hierarchical directory structure in one command.
Listing Directory Contents¶
- Display all files and folders in the current directory:
- Lists the contents of the current directory.
Moving and Renaming Files and Folders¶
- Move a file:
-
Moves the file to the specified folder.
-
Rename a file:
-
Renames the file.
-
Move a folder and its contents:
- Moves the entire folder and its contents.
Deleting Files and Folders¶
- Delete a file:
-
Permanently deletes the specified file.
-
Delete an empty folder:
-
Deletes the specified folder if it is empty.
-
Delete a folder and all its contents:
- Deletes the folder and all files within it recursively.
Retrieving System Information¶
- Display the current IP address:
-
Shows network and IP information.
-
Display detailed network information:
-
Shows a detailed list of all network interfaces and configurations.
-
Display running processes:
-
Displays a list of currently running processes.
-
Terminate a process:
- Forcefully ends the Notepad process.
Conclusion¶
The Windows Command Line is a useful tool for system management, automation, and file operations. With these fundamental commands, you can work more efficiently. A great way to develop CLI skills is by experimenting in a test environment.