Intro
I. Introduction to Windows Command Line
A. Definition of Command Line Interface (CLI)
The Command Line Interface (CLI) is a text-based interface for interacting with a computer's operating system or software by typing commands.
B. Importance of command line skills in IT and system administration
Command line skills are crucial for efficient system management, automation, and troubleshooting in IT environments.
C. Differences between Command Prompt (CMD) and PowerShell
Command Prompt is the traditional command-line interpreter for Windows, while PowerShell is a more powerful scripting language and command-line shell.
II. Basic Command Line Navigation
A. Accessing the Command Prompt
- Methods to open CMD:
- Press Win + R, type "cmd", and press Enter
- Type "cmd" in the Start menu search bar
- Right-click Start button and select "Command Prompt"
B. Navigating the file system
- 'cd' - Change directory
cd C:\Users\Username\Documents
cd ..
cd \
- 'dir' - List directory contents
dir
dir /a
dir /s
- 'cls' - Clear screen
cls
- 'mkdir' - Create new directory
mkdir NewFolder
mkdir "New Folder with Spaces"
- 'rmdir' - Remove directory
rmdir EmptyFolder
rmdir /s /q FolderWithContents
III. File Management Commands
A. Viewing files and directories
- 'dir' - List files and folders in the current directory
dir
dir /a
dir *.txt
- 'attrib' - View file attributes
attrib filename.txt
attrib +r filename.txt
B. Creating and deleting files
- 'echo' - Create text files
echo Hello, World! > hello.txt
echo This is a new line >> hello.txt
- 'del' - Delete files
del filename.txt
del *.tmp
C. Copying and moving files
- 'copy' - Copy files
copy source.txt destination.txt
copy *.txt C:\Backup\
- 'move' - Move files
move oldfile.txt C:\NewFolder\
move *.doc C:\Documents\
IV. System Information and Diagnostics Commands
A. Checking network information
- 'ipconfig' - Display network configuration
ipconfig
ipconfig /all
- 'ping' - Test network connectivity
ping google.com
ping 192.168.1.1
- 'tracert' - Trace the route to a remote host
tracert google.com
B. Viewing system information
- 'systeminfo' - Display system configuration
systeminfo
- 'tasklist' - View running processes
tasklist
tasklist | find "chrome"
C. Managing processes
- 'taskkill' - Terminate processes
taskkill /IM notepad.exe
taskkill /PID 1234 /F
V. File and Disk Management
A. Disk management commands
- 'chkdsk' - Check disk for errors
chkdsk C:
chkdsk C: /f
- 'diskpart' - Manage disks and partitions
diskpart
list disk
select disk 0
list partition
B. File compression and decompression
- 'compact' - Compress files and folders
compact /c file.txt
compact /c /s C:\FolderToCompress
- 'expand' - Uncompress files
expand compressed.cab
expand -r *.cab
VI. Advanced Windows Commands
A. 'netstat' - Display network connections
netstat
netstat -an
B. 'shutdown' - Shutdown or restart the system
shutdown /s /t 60
shutdown /r /t 0
C. 'sfc' - System File Checker to repair system files
sfc /scannow
D. 'powercfg' - Manage power settings and configurations
powercfg /energy
powercfg /batteryreport
VII. Batch File Basics
A. Definition and purpose of batch files
Batch files are scripts containing a series of commands to be executed by the command-line interpreter.
B. Creating and executing a batch file
Create a file with .bat extension and add commands:
@echo off
echo Hello, World!
pause
Save as "example.bat" and double-click to run.
C. Useful batch file commands
@echo off
echo This is a batch file example
pause
cls
echo The screen has been cleared
VIII. Conclusion
A. Recap of key commands
We've covered essential Windows commands for navigation, file management, system information, and more.
B. Importance of practicing command line skills
Regular practice will improve efficiency and problem-solving abilities in IT and system administration.