Catalog / Windows Terminal Environments Cheatsheet

Windows Terminal Environments Cheatsheet

A comprehensive cheat sheet covering essential commands and concepts for both Windows CMD and PowerShell, providing quick references for navigation, file management, system information, and more.

Basic Navigation & File Management

Command Prompt (CMD) - Navigation

cd directory

Change directory to the specified directory.

cd ..

Move up one directory level.

cd \

Change to the root directory.

dir

List files and subdirectories in the current directory.

tree

Display the directory structure graphically.

pushd directory

Saves the current directory for use later and changes to specified directory.

popd

Returns to the directory most recently saved by the pushd command.

PowerShell - Navigation

Set-Location directory

Change directory to the specified directory.

Set-Location ..

Move up one directory level.

Get-ChildItem

List files and subdirectories in the current directory (alias: ls, dir).

Push-Location directory

Saves the current location to a stack and changes to the specified location.

Pop-Location

Retrieves the last location from the location stack.

Get-Location

Displays the current directory.

File Management (CMD)

mkdir directory

Create a new directory.

rmdir directory

Remove an empty directory.

del filename

Delete a file.

copy source destination

Copy a file.

ren oldname newname

Rename a file.

File Management & System Info

File Management (PowerShell)

New-Item directory -ItemType Directory

Create a new directory.

Remove-Item directory

Remove a directory (can also remove files).

Copy-Item source destination

Copy a file or directory.

Rename-Item oldname newname

Rename a file or directory.

Move-Item source destination

Move a file or directory.

New-Item filename -ItemType File

Creates a new file.

System Information (CMD)

systeminfo

Display detailed system configuration information.

tasklist

Display a list of currently running processes.

ipconfig

Display IP configuration information.

hostname

Displays the hostname of the machine.

System Information (PowerShell)

Get-ComputerInfo

Display comprehensive computer information.

Get-Process

Display a list of currently running processes.

Get-NetIPConfiguration

Display IP configuration information.

Get-Host

Displays information about the current PowerShell host.

Test-Path path

Check if the specified path exists.

Process Management & Networking

Process Management (CMD)

taskkill /IM processname.exe /F

Forcefully terminate a process by image name.

taskkill /PID processID /F

Forcefully terminate a process by process ID.

start program

Start a program.

Process Management (PowerShell)

Stop-Process -Name processname -Force

Forcefully terminate a process by name.

Stop-Process -Id processID -Force

Forcefully terminate a process by process ID.

Start-Process program

Start a program.

Get-Service

Get a list of the services available on the computer.

Stop-Service servicename

Stop a service.

Start-Service servicename

Start a service.

Networking (CMD)

ping hostname

Ping a hostname or IP address.

tracert hostname

Trace route to a hostname.

netstat -a

Display active TCP connections, listening ports, etc.

Advanced Commands & Scripting

Networking (PowerShell)

Test-Connection hostname

Ping a hostname or IP address.

Test-Path -Path 'TCP:hostname:port'

Test a specific TCP port.

Get-NetTCPConnection

Get active TCP connections.

Resolve-DnsName hostname

Query DNS for hostname.

CMD Scripting

@echo off - Disable command echoing.
echo message - Display a message.
set variable=value - Define a variable.
%variable% - Access a variable.
if condition (commands) else (commands) - Conditional execution.
for %%i in (set) do (command) - Loop through a set of items.

PowerShell Scripting

$variable = value - Define a variable.
$variable - Access a variable.
if (condition) { commands } elseif (condition) { commands } else { commands } - Conditional execution.
foreach ($i in $collection) { commands } - Loop through a collection.
function functionName { commands } - Define a function.
Write-Host message - Display a message.
Get-Help command - Get help for a command.