techweb24.dev
README.md

Windows CMD and PowerShell Commands Every User Should Know (2026)

The Windows command line is still the fastest way to fix network problems, find files, check your system and automate boring tasks. This guide covers the commands developers and power users actually use on Windows 10 and Windows 11, with the Command Prompt (CMD) version and the PowerShell equivalent side by side.

Updated for 2026. Windows 11 opens Windows Terminal by default, which can run both CMD and PowerShell in tabs. Everything below works in either.

How to open the command line

  • Quickest: press Win+R, type cmd or powershell, press Enter.
  • As administrator: press Win+X and choose Terminal (Admin). Commands that change system settings need this.
  • In a folder: in File Explorer, click the address bar, type cmd and press Enter to open CMD already in that folder.

Navigating folders and files

TaskCMDPowerShell
Show current foldercdGet-Location (or pwd)
List filesdirGet-ChildItem (or ls)
Change foldercd C:\Projectscd C:\Projects
Go up one levelcd ..cd ..
Switch driveD:D:
Create foldermkdir logsNew-Item -ItemType Directory logs
Copy filecopy a.txt b.txtCopy-Item a.txt b.txt
Move / renamemove a.txt old\ / ren a.txt b.txtMove-Item / Rename-Item
Delete filedel a.txtRemove-Item a.txt
Show file contentstype notes.txtGet-Content notes.txt
Clear screenclscls
:: list everything, including hidden files, one page at a time
dir /a | more

:: show the folder tree
tree C:\Projects /f

Finding files and text

# find every .log file under the current folder
Get-ChildItem -Recurse -Filter *.log

# the 10 largest files under C:\Users\you\Downloads
Get-ChildItem "$env:USERPROFILE\Downloads" -Recurse -File |
  Sort-Object Length -Descending | Select-Object -First 10 Name, @{n='MB';e={[math]::Round($_.Length/1MB,1)}}

# search inside files for a word (like grep)
Select-String -Path .\src\*.js -Pattern "TODO"
:: CMD version: search text in files
findstr /s /i "TODO" *.js

Network troubleshooting

CommandWhat it does
ipconfigShows your IP address, gateway and DNS servers.
ipconfig /flushdnsClears the DNS cache. Fixes many "site won't load" problems after DNS changes.
ping google.comChecks if you can reach a host and how fast.
tracert google.comShows every hop between you and a host.
nslookup example.comShows what IP a domain points to.
netstat -anoLists open connections and the process ID using each port.
# is a port open on a server? (great for testing web servers and databases)
Test-NetConnection example.com -Port 443

# which program is using port 3000?
Get-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess

Processes and services

:: list running programs
tasklist

:: force-close a frozen app by name or PID
taskkill /im chrome.exe /f
taskkill /pid 4512 /f
# top 5 processes by memory
Get-Process | Sort-Object WorkingSet -Descending | Select-Object -First 5 Name, Id, @{n='MB';e={[int]($_.WorkingSet/1MB)}}

# check and restart a service (run as admin)
Get-Service -Name Spooler
Restart-Service -Name Spooler

System information and repair

CommandWhat it does
systeminfoWindows version, install date, RAM, last boot time.
winverOpens a window with the exact Windows build.
sfc /scannowScans and repairs corrupted Windows system files (admin).
DISM /Online /Cleanup-Image /RestoreHealthRepairs the Windows image that sfc uses. Run it before sfc if sfc can't fix things (admin).
chkdsk C: /fChecks the disk for errors. Runs at next restart for the system drive (admin).
powercfg /batteryreportCreates an HTML report of your laptop battery's health.
shutdown /r /t 0Restarts immediately. /s shuts down instead.

Installing software with winget

Windows 10 and 11 include winget, a package manager. It installs and updates apps without visiting websites:

winget search vscode
winget install Microsoft.VisualStudioCode
winget install Git.Git OpenJS.NodeJS.LTS Python.Python.3.12

# update every app that has an update
winget upgrade --all

Environment variables and PATH

# show PATH, one folder per line
$env:Path -split ';'

# where is a program installed?
Get-Command node
where.exe python

A tiny automation example

Save this as backup.ps1 to copy a project folder into a dated backup folder:

$source = "C:\Projects\my-site"
$dest   = "D:\Backups\my-site-$(Get-Date -Format yyyy-MM-dd)"
Copy-Item $source $dest -Recurse
Write-Host "Backed up to $dest"

Run it with powershell -ExecutionPolicy Bypass -File .\backup.ps1, or schedule it with Task Scheduler.

Commands like del, Remove-Item -Recurse, format and diskpart don't use the Recycle Bin. Double-check the path before pressing Enter.

Handy shortcuts

  • Tab completes file and folder names.
  • ↑ / ↓ scroll through previous commands.
  • Ctrl+C stops a running command.
  • Add /? to any CMD command (dir /?) or use Get-Help in PowerShell (Get-Help Copy-Item -Examples) to see its options.

Which command do you use most? Share it in the comments.

Zubaer Ahammed

Full-stack & Android developer from Bangladesh. Builds web platforms and apps and writes practical tutorials here. zubaer.com

Comments

Post a Comment