Window Commands

Window command

Windows CMD Commands

File & Folder

CommandDescriptionExample
`dir`List files & folders`dir`
`cd`Change directory`cd Documents`
`mkdir`Create folder`mkdir test`
`rmdir`Delete folder`rd test`
`copy`Copy file`copy a.txt b.txt`
`xcopy`Advanced copy`xcopy src dest /s`
`robocopy`Robust file copy`robocopy A B`
`move`Move file`move a.txt D:\\`
`del`Delete file`del a.txt`
`ren`Rename file`ren a.txt b.txt`
`type`Show file content`type file.txt`
`cls`Clear screen`cls`
`exit`Close CMD`exit`
`tree`Folder structure`tree`
`attrib`Change attributes`attrib +h file.txt`
`fc`Compare files`fc a.txt b.txt`

Disk & System

CommandDescriptionExample
`chkdsk`Check disk errors`chkdsk C:`
`diskpart`Disk partition tool`diskpart`
`format`Format drive`format D:`
`label`Change drive label`label D: DATA`
`vol`Show volume info`vol`
`defrag`Disk defragment`defrag C:`

System Info

CommandDescriptionExample
`systeminfo`Full system details`systeminfo`
`hostname`PC name`hostname`
`ver`Windows version`ver`
`date`Show/change date`date`
`time`Show/change time`time`
`driverquery`Installed drivers`driverquery`

Network

CommandDescriptionExample
`ipconfig`IP details`ipconfig /all`
`ping`Test connectivity`ping google.com`
`tracert`Route path`tracert google.com`
`netstat`Network stats`netstat -an`
`nslookup`DNS lookup`nslookup google.com`
`arp`ARP table`arp -a`
`route`Routing table`route print`
`getmac`MAC address`getmac`

User & Permissions

CommandDescriptionExample
`net user`Manage users`net user`
`net localgroup`Manage groups`net localgroup`
`net share`Shared resources`net share`
`whoami`Current user`whoami`
`runas`Run as another user`runas /user:admin cmd`

Process & Services

CommandDescriptionExample
`tasklist`Running processes`tasklist`
`taskkill`Kill process`taskkill /PID 1234 /F`
`sc`Service control`sc query`
`schtasks`Scheduled tasks`schtasks /query`

System Repair

CommandDescriptionExample
`sfc`System file check`sfc /scannow`
`dism`Windows image repair`dism /online /cleanup-image /restorehealth`
`eventvwr`Event Viewer`eventvwr`
`perfmon`Performance monitor`perfmon`

PowerShell Commands

File & Folder

CmdletDescriptionExample
`Get-ChildItem`List files`Get-ChildItem`
`Set-Location`Change folder`cd Documents`
`New-Item`Create file/folder`New-Item test.txt`
`Remove-Item`Delete item`Remove-Item test.txt`
`Copy-Item`Copy item`Copy-Item a.txt b.txt`
`Move-Item`Move item`Move-Item a.txt D:\\`
`Rename-Item`Rename item`Rename-Item a b`

Process Management

CmdletDescriptionExample
`Get-Process`Running processes`Get-Process`
`Start-Process`Start program`Start-Process notepad`
`Stop-Process`Stop process`Stop-Process -Name chrome`

Services

CmdletDescriptionExample
`Get-Service`List services`Get-Service`
`Start-Service`Start service`Start-Service Spooler`
`Stop-Service`Stop service`Stop-Service Spooler`
`Restart-Service`Restart service`Restart-Service Spooler`

Network

CmdletDescriptionExample
`Test-Connection`Ping`Test-Connection google.com`
`Test-NetConnection`Port test`Test-NetConnection google.com -Port 80`
`Get-NetIPAddress`IP info`Get-NetIPAddress`
`Resolve-DnsName`DNS lookup`Resolve-DnsName google.com`

Users

CmdletDescriptionExample
`Get-LocalUser`List users`Get-LocalUser`
`New-LocalUser`Create user`New-LocalUser name`
`Remove-LocalUser`Delete user`Remove-LocalUser name`

File Content

| Cmdlet | Description | Example | | --------------- | ----------- | -------------------------------- | ------------------- | | `Get-Content` | Read file | `Get-Content file.txt` | | `Set-Content` | Write file | `Set-Content file.txt "Hello"` | | `Add-Content` | Append text | `Add-Content file.txt "Hi"` | | `Out-File` | Save output | `dir | Out-File list.txt` |

Automation & Scripting

CmdletDescriptionExample
`Invoke-Command`Run remote command`Invoke-Command`
`Start-Job`Background task`Start-Job`
`Get-Job`Job status`Get-Job`
`Stop-Job`Stop job`Stop-Job`