30 Windows Command Line Cheat Sheet
Welcome to your essential guide for mastering the Windows Command Line. Whether you’re a beginner or an advanced user, these commands will help you manage files, folders, networks, and more. Let’s dive into the core commands and their uses.
A. Opening and Managing Files/Folders
- Always open Command Prompt in Administrator Mode:
1
| runas /user:Administrator cmd
|
- Hide zip or rar files inside an image:
1
| copy /b image.extension+folder.zip image.extension
|
- Show all Wi-Fi passwords:
1
2
| netsh wlan show profile
netsh wlan show profile wifinetwork key=clear | findstr "Key Content"
|
1
| for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @if "%j" NEQ "" (echo SSID: %j & netsh wlan show profiles %j key=clear | findstr "Key Content") & echo.
|
- Encrypt files in a folder:
- Save output of a command to a file:
- Hide a folder from everyone:
1
2
| attrib +h +s +r foldername
attrib -h -s -r foldername
|
- Display detailed system information:
- Remove a mounted drive:
- Securely copy files between remote hosts:
1
| scp file.txt root@serverip:~/file.txt
|
- Change the background and text color in Command Prompt:
1
| color 07 [background:text]
|
- Change the prompt text:
- Map a regular folder as a mounted drive:
1
| subst q: c://filelocation
|
- Change the title of Command Prompt window:
C. Network
- Curl the weather:
- Check your public IP address:
1
| curl checkip.amazonaws.com
|
- Curl shortened links to figure out the destination:
1
| curl --head --location "https://samurai1337x.github.io/"
|
- Generate a QR code:
1
| curl qrenco.de/https://samurai1337x.github.io
|
- Check the status of a website:
1
| curl -IsL http://samurai1337x.github.io/ | findstr ^Location
|
- Check latest social media posts:
1
2
| curl -s https://decapi.me/youtube/latest_video?user=samurai1337x
curl -s https://decapi.me/twitter/latest?name=samurai1337x
|
- Define a word:
1
| curl dict.org/d:contretemps
|
- Use ChatGPT in CMD with Curl:
1
| curl https://api.openai.com/v1/chat/completions -H "Authorization: Bearer sk-xxx" -H "Content-Type: application/json" -d "{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"user\", \"content\": \"Who is NetworkChuck?\"}]}"
|
E. File and Folder Management
- Visit a website:
1
| start www.samurai1337x.github.io
|
- Telnet to a server:
- Delete temporary files to clear space:
1
2
| del /q /f /s %temp%\\*
del /s /q C:\Windows\temp\*
|
- View the history of commands:
F. Windows Terminal
- Use Windows Terminal instead of Command Prompt:
- Download and install Windows Terminal from the Microsoft Store or GitHub.
- Set your preferred terminal as the default in “Settings.”
1
| Open Windows Terminal, press Ctrl+Shift+T for a new tab.
|
- Open Terminal from any folder:
1
| Shift-right-click on the folder and select Terminal.
|
- Drag and drop files into Terminal for the file path:
- Open Windows Terminal.
- Drag and drop the file into the terminal to paste its path.
- Use PowerShell for advanced tasks beyond Command Prompt.
- Get help in the terminal:
This cheat sheet is your go-to resource for Windows Command Line. With these commands, you can efficiently manage files, folders, systems, and networks. Bookmark this post for quick reference!