Skip to content

cyber-security

What is Windows

Microsoft Windows is a product line of proprietary graphical operating systems developed and marketed by Microsoft

Windows Server

SysAdmin Windows

Windows Command Prompt (CMD) cheat sheet tailored for both new users and administrators. This guide covers basic navigation commands, file management, network utilities, and system tasks, providing a solid foundation for working effectively within the Windows environment.

Getting Started with CMD

  1. Open CMD: Press Win + R, type cmd, and press Enter.
  2. Open CMD as Administrator: Press Win + X and select "Command Prompt (Admin)" or "Windows PowerShell (Admin)" depending on your Windows version.

Basic Navigation

  1. Change Directory: cd [directory name]
  2. Move into a specific directory: cd Documents
  3. Move up one directory: cd ..
  4. List Contents: dir
  5. Displays all files and directories in the current directory

File Management

  1. Create a New Directory: mkdir [directory name]
  2. Example: mkdir NewFolder
  3. Create a New File: echo > [file name]
  4. Example: echo > example.txt
  5. Delete a File: del [file name]
  6. Example: del example.txt
  7. Rename a File: rename [current name] [new name]
  8. Example: rename oldname.txt newname.txt
  9. Copy a File: copy [source] [destination]
  10. Example: copy example.txt D:\Backup
  11. Move a File: move [source] [destination]
  12. Example: move example.txt D:\Documents

File Management

  1. Ping: ping [hostname or IP]
  2. Checks connectivity with another network device.
  3. IP Configuration: ipconfig
  4. Displays the IP address, subnet mask, and default gateway for all adapters.
  5. Trace Route: tracert [hostname or IP]
  6. Determines the path packets take to reach a specific destination.

System Tasks

  1. View System Information: systeminfo
  2. Displays detailed configuration information about a computer and its operating system.
  3. Shutdown or Restart Computer:
  4. Shutdown: shutdown /s /t [time in seconds]
  5. Restart: shutdown /r /t [time in seconds]
  6. View Task List: tasklist
  7. Displays a list of currently running processes.
  8. Kill a Task: taskkill /IM [process name] /F
  9. Example: taskkill /IM notepad.exe /F

Advanced Commands for Administrators

  1. Disk Partition Management: diskpart
  2. A powerful tool to manage disk partitions.
  3. Network Statistics: netstat
  4. Displays active connections, listening ports, and network statistics.
  5. Service Management:
  6. Start a service: net start [service name]
  7. Stop a service: net stop [service name]
  8. File System Check: chkdsk
  9. Checks the filesystem on a disk and fixes logical file system errors.

User Management

  1. Add a New User: net user [username] [password] /add
  2. Example: net user John p@ssw0rd /add
  3. Delete a User: net user [username] /delete
  4. Example: net user John /delete
  5. Add User to Group: net localgroup [groupname] [username] /add
  6. Example: net localgroup Administrators John /add

SMB Shares

  1. List Shared Resources: net share
  2. Create a Share: net share [sharename]=[folderpath] /grant:[username],FULL
  3. Example: net share DataShare=C:\Data /grant:John,FULL
  4. Delete a Share: net share [sharename] /delete
  5. Example: net share DataShare /delete

Group Policy Objects (GPOs)

While direct manipulation of GPOs is not typically done through CMD (it’s more common with PowerShell or Group Policy Management Console — GPMC), you can refresh GPO settings for a computer or user:

  1. Refresh GPO Settings: gpupdate /force
  2. This command enforces an immediate refresh of all GPO settings.

Security and Firewall Commands

  1. View Firewall Status: netsh advfirewall show allprofiles
  2. Enable Firewall: netsh advfirewall set allprofiles state on
  3. Disable Firewall: netsh advfirewall set allprofiles state off

  4. Add Firewall Rule: netsh advfirewall firewall add rule name="[name]" dir=in action=allow protocol=TCP localport=[port]

  5. Example: netsh advfirewall firewall add rule name="Allow Port 80" dir=in action=allow protocol=TCP localport=80

Encryption and Security

  1. Encrypt a File or Folder: cipher /e [path] Example: cipher /e C:\SensitiveData

  2. Decrypt a File or Folder: cipher /d [path] Example: cipher /d C:\SensitiveData

Managing Services

View Status of All Services: sc query Start a Service: net start [service name] Example: net start wuauserv Stop a Service: net stop [service name] Example: net stop wuauserv

Helpful Tips

  1. Auto-Completion: Press Tab to auto-complete file and directory names.
  2. Command History: Press Up or Down arrow keys to navigate through previously used commands.
  3. Help for Commands: Type command /?, e.g., cd /?, to view help for a specific command.

This cheat sheet provides a starting point for using the Windows Command Prompt. Experimenting with these commands and exploring further will greatly enhance your proficiency in managing Windows systems via CMD.

Windows CMD cheat sheet for Windows Administration and Security

Windows .cpl & .msc Command Cheat sheet

Basic Command Line

What is PowerShell?

PowerShell is a cross-platform task automation solution made up of a command-line shell, a scripting language, and a configuration management framework. PowerShell runs on Windows, Linux, and macOS.

Opening CMD Shortcut

Simply go to the address bar of that folder type "cmd" and hit "enter".

Hide Folders

attrib +h +s +r filename

Unhide File

attrib -h -s -r file name

Check your laptop’s battery health

powercfg /batteryreport /output "C:\battery_report.html"

Scan for system problems (in administrative mode)

sfc /scannow

View your Windows license key

wmic path softwarelicensingservice get OA3xOriginalProductKey

Save folder trees to disk

tree
tree > "c:\export.txt"

Delete Incognito History on Android (Chrome Browser)

  1. chrome://net-internals/#dns

  2. Clear Host Cache’ to delete the Device’s DNS Cache.

  3. Exit

The shortcut key for opening a new Incognito Mode window:

Google Chrome: Ctrl + Shift + N (Windows), 
Command + Shift + N (Mac)

Mozilla Firefox: Ctrl + Shift + P (Windows), 
Command + Shift + P (Mac)

Microsoft Edge: Ctrl + Shift + P (Windows)
Command + Shift + P (Mac)