Total Pageviews

Featured Post

CI/CD +playwright

  Playwright CI/CD Using Azure DevOps (ADO) – Step by Step Step 1: Prerequisites Make sure you have: Azure DevOps project Git repo with Play...

Thursday, December 18, 2025

Command prompt commands

 

System Information & Management

Command Usage

systeminfo Displays detailed system configuration (OS, BIOS, RAM, etc.)

hostname Shows the computer name

ver Displays the Windows version

set Shows all environment variables

setx VAR VALUE Sets a permanent environment variable

echo %VAR% Displays the value of an environment variable

tasklist Lists all running processes

taskkill /IM process.exe /F Force-kills a specific process

wmic os get caption Displays OS name

whoami Shows current user

date /t & time /t Shows current date and time


🟨 2. File & Folder Operations

Command Usage

dir Lists files and folders in the current directory

cd foldername Changes to a directory

cd .. Moves up one directory level

md foldername / mkdir foldername Creates a new folder

rmdir foldername Removes an empty folder

rmdir /S /Q foldername Deletes a folder and its contents silently

del filename Deletes a file

copy file1 file2 Copies files

xcopy source dest /E /I Copies entire directories (deprecated but common)

robocopy source dest /E Robust copy for folders, preserves attributes

move file1 folder Moves or renames files

ren oldname newname Renames files or folders

attrib +r file.txt Sets file as read-only (-r to remove)


🟧 3. Networking Commands

Command Usage

ipconfig Shows IP configuration

ipconfig /all Shows full network adapter details

ipconfig /release Releases IP address

ipconfig /renew Renews IP address

ping hostname Checks network connectivity

tracert hostname Traces route packets take to destination

nslookup domain Looks up DNS information

netstat -ano Lists network connections & ports with PIDs

netsh wlan show profiles Lists saved Wi-Fi profiles

netsh wlan show profile name="SSID" key=clear Shows Wi-Fi password for a network

ftp Opens FTP session (old but still used)

telnet host port Tests connectivity to a specific port (if Telnet Client installed)


🟩 4. Disk & File System Commands

Command Usage

chkdsk C: Checks disk for errors

chkdsk C: /F /R Fixes errors and recovers bad sectors

diskpart Opens disk partitioning tool (advanced)

label Changes volume label

vol Shows volume label and serial number

fsutil fsinfo drives Lists all drives

format X: Formats a drive (⚠ destructive)

sfc /scannow Scans and repairs system files

defrag C: Defragments a disk


🟪 5. User & Security Commands

Command Usage

net user Lists all user accounts

net user username Shows details about a user

net user newuser password /add Creates a new user

net localgroup administrators username /add Adds user to Administrators group

net accounts Shows password policies

runas /user:domain\user cmd Runs a command as another user

cipher /w:C:\ Securely wipes free space on drive

shutdown /r /t 0 Reboots computer immediately

shutdown /s /t 60 Shuts down after 60 seconds

shutdown /a Aborts a scheduled shutdown


🟥 6. System Configuration & Troubleshooting

Command Usage

msconfig Opens System Configuration GUI

regedit Opens Windows Registry Editor

eventvwr Opens Event Viewer

services.msc Opens Services console

devmgmt.msc Opens Device Manager

driverquery Lists installed drivers

driverquery /si Lists signed driver info

bcdedit Edits boot configuration data

sfc /verifyonly Verifies system files without fixing

DISM /Online /Cleanup-Image /RestoreHealth Repairs Windows image


⚙ 7. Batch Scripting Essentials

Command Usage

echo text Displays text

@echo off Turns off command echo in batch scripts

pause Waits for user input

cls Clears the screen

call Calls another batch file

if / else Conditional execution

for /L %%i in (1,1,5) do ... Looping in batch

goto label Jumps to label

exit Exits the command prompt or script


📝 Bonus: Useful One-Liners

Command Description

tree /f Displays folder structure including files

fc file1 file2 Compares two text files

clip < file.txt Copies file content to clipboard

type nul > filename.txt Creates an empty file

assoc / ftype View/change file associations

title MyPrompt Changes the CMD window title

color 0A Changes CMD text and background color (here: black bg, green text)