Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Common Windows CMD Commands with Safe Examples

Use current Command Prompt commands to navigate folders, manage files, inspect networks and processes, redirect output, and avoid destructive CMD mistakes.

Table of Contents

Windows Command Prompt uses Win32 console commands; calling every command a “DOS command” is imprecise on modern Windows. The most useful CMD commands let you navigate folders, inspect files, copy or move data, check network settings, list processes, and connect commands in a batch file. Start with read-only commands, quote paths containing spaces, and verify a target before using del, rmdir, or forced process termination.

Open Command Prompt and get help

Press Windows+S, type cmd, and open Command Prompt. You can also press Windows+R, enter cmd, and press Enter. Windows Terminal may open PowerShell by default; select a Command Prompt profile or run cmd when you specifically need CMD syntax.

help
dir /?
copy /?

help lists built-in commands. Appending /? shows syntax and options for a command. TipsMake also explains how to find CMD commands and ways to open Command Prompt.

CommandPurposeExample
cdShow or change the current directorycd /d "D:\Projects"
dirList files and foldersdir /a
mkdir or mdCreate a directorymkdir "D:\Projects\Demo"
rmdir or rdRemove an empty directoryrmdir "D:\Projects\Demo"
pushdSave the current location and change directorypushd "D:\Projects"
popdReturn to the location saved by pushdpopd

cd /d changes both drive and directory. Without /d, a path on another drive can produce confusing results.

Copy a file

Use quotes around complete Windows paths. This copies one file into an existing destination folder:

copy "D:\Examples\tipsmake.zip" "D:\Books\"

Some commonly used DOS commands in CMD Picture 1

If the destination file already exists, copy may ask whether to overwrite it. For directory trees and resumable copies, use robocopy after reading robocopy /?; its options have different overwrite and deletion behavior from copy.

Delete a file carefully

First verify the exact match:

dir "D:\Examples\tipsmake.zip"

Then delete only that file:

del "D:\Examples\tipsmake.zip"

Some commonly used DOS commands in CMD Picture 2

del normally bypasses Recycle Bin. Avoid broad wildcards such as del *.* until you have confirmed the current directory and previewed the matching files with dir.

Create and remove directories

mkdir "D:\Examples\NewFolder"
rmdir "D:\Examples\NewFolder"

Some commonly used DOS commands in CMD Picture 3

A plain rmdir removes only an empty directory. The /s option deletes a directory tree and its contents, so do not add it casually.

Some commonly used DOS commands in CMD Picture 4

Other useful file commands

CommandExampleResult
movemove "D:\Drafts\note.txt" "D:\Archive\"Moves a file
renren "D:\Archive\note.txt" "notes-2026.txt"Renames a file
typetype "D:\Archive\notes-2026.txt"Displays a text file
wherewhere pythonShows matching executable locations in the search path
findstrfindstr /i "error" "*.log"Finds text in matching files
treetree "D:\Projects" /fDisplays a directory tree including files

View network information

ipconfig
ipconfig /all

ipconfig shows basic adapter addresses. ipconfig /all adds details such as adapter descriptions, DHCP status, DNS servers, and physical addresses.

Some commonly used DOS commands in CMD Picture 5

Do not read the first IPv4 address blindly when several adapters are present. Match the adapter to the active Ethernet, Wi-Fi, VPN, or virtual network. TipsMake's ipconfig guide explains release and renewal commands; releasing a DHCP lease can interrupt connectivity, so use those operations only when troubleshooting calls for them.

Test name resolution and connectivity

CommandPurpose
ping example.comTests whether replies return and measures round-trip time; blocked replies do not always mean the service is down
tracert example.comShows the route hops that respond
nslookup example.comQueries DNS resolution
netstat -anoLists connections, listening ports, and process IDs
getmacDisplays MAC addresses for local adapters

These commands reveal diagnostic information, not a complete security verdict. Firewalls, VPNs, proxies, IPv6, and server policy can change the output.

List and stop processes

tasklist
tasklist /fi "imagename eq notepad.exe"

After confirming the intended process, close it normally if possible. If it is unresponsive:

taskkill /im notepad.exe

Use /f only as a last resort because forced termination can lose unsaved work:

taskkill /f /pid 1234

Replace 1234 with a PID verified in tasklist or Task Manager. Internet Explorer examples are obsolete, and the correct historical process name was not iexplorer.exe.

System information and identity

  • whoami shows the current security identity.
  • hostname shows the computer name.
  • systeminfo displays operating-system, update, memory, and hardware summary data.
  • set displays CMD environment variables; echo %PATH% prints the executable search path.
  • ver prints the Windows command processor's reported version.

Redirect and combine commands

ipconfig /all > "D:\Diagnostics\network.txt"
systeminfo >> "D:\Diagnostics\network.txt"
tasklist | findstr /i "notepad"
mkdir "D:\Work" && cd /d "D:\Work"
dir "D:\Missing" || echo The directory could not be listed.
  • > replaces the destination file with command output.
  • >> appends output.
  • | sends one command's output to another command.
  • && runs the next command only after success.
  • || runs the next command only after failure.

CMD and PowerShell syntax differ

Many executable programs work in both shells, but aliases, variables, quoting, pipelines, and script syntax differ. A command copied from a PowerShell tutorial may not work in CMD, and destructive operations can have different confirmation behavior. The Microsoft Windows command reference documents current Win32 commands for Windows 10, Windows 11, and supported Windows Server releases.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.