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¶
- Open CMD: Press Win + R, type cmd, and press Enter.
- Open CMD as Administrator: Press Win + X and select "Command Prompt (Admin)" or "Windows PowerShell (Admin)" depending on your Windows version.
Basic Navigation¶
- Change Directory: cd [directory name]
- Move into a specific directory: cd Documents
- Move up one directory: cd ..
- List Contents: dir
- Displays all files and directories in the current directory
File Management¶
- Create a New Directory: mkdir [directory name]
- Example: mkdir NewFolder
- Create a New File: echo > [file name]
- Example: echo > example.txt
- Delete a File: del [file name]
- Example: del example.txt
- Rename a File: rename [current name] [new name]
- Example: rename oldname.txt newname.txt
- Copy a File: copy [source] [destination]
- Example: copy example.txt D:\Backup
- Move a File: move [source] [destination]
- Example: move example.txt D:\Documents
File Management¶
- Ping: ping [hostname or IP]
- Checks connectivity with another network device.
- IP Configuration: ipconfig
- Displays the IP address, subnet mask, and default gateway for all adapters.
- Trace Route: tracert [hostname or IP]
- Determines the path packets take to reach a specific destination.
System Tasks¶
- View System Information: systeminfo
- Displays detailed configuration information about a computer and its operating system.
- Shutdown or Restart Computer:
- Shutdown: shutdown /s /t [time in seconds]
- Restart: shutdown /r /t [time in seconds]
- View Task List: tasklist
- Displays a list of currently running processes.
- Kill a Task: taskkill /IM [process name] /F
- Example: taskkill /IM notepad.exe /F
Advanced Commands for Administrators¶
- Disk Partition Management: diskpart
- A powerful tool to manage disk partitions.
- Network Statistics: netstat
- Displays active connections, listening ports, and network statistics.
- Service Management:
- Start a service: net start [service name]
- Stop a service: net stop [service name]
- File System Check: chkdsk
- Checks the filesystem on a disk and fixes logical file system errors.
User Management¶
- Add a New User: net user [username] [password] /add
- Example: net user John p@ssw0rd /add
- Delete a User: net user [username] /delete
- Example: net user John /delete
- Add User to Group: net localgroup [groupname] [username] /add
- Example: net localgroup Administrators John /add
SMB Shares¶
- List Shared Resources: net share
- Create a Share: net share [sharename]=[folderpath] /grant:[username],FULL
- Example: net share DataShare=C:\Data /grant:John,FULL
- Delete a Share: net share [sharename] /delete
- 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:
- Refresh GPO Settings: gpupdate /force
- This command enforces an immediate refresh of all GPO settings.
Security and Firewall Commands¶
- View Firewall Status: netsh advfirewall show allprofiles
- Enable Firewall: netsh advfirewall set allprofiles state on
Disable Firewall: netsh advfirewall set allprofiles state off
Add Firewall Rule: netsh advfirewall firewall add rule name="[name]" dir=in action=allow protocol=TCP localport=[port]
Example: netsh advfirewall firewall add rule name="Allow Port 80" dir=in action=allow protocol=TCP localport=80
Encryption and Security¶
Encrypt a File or Folder: cipher /e [path] Example: cipher /e C:\SensitiveData
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¶
- Auto-Completion: Press Tab to auto-complete file and directory names.
- Command History: Press Up or Down arrow keys to navigate through previously used commands.
- 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)
chrome://net-internals/#dns
Clear Host Cache’ to delete the Device’s DNS Cache.
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)