Post

30 Windows Command Line Cheat Sheet

30 Windows Command Line Cheat Sheet

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

  1. Always open Command Prompt in Administrator Mode:
    1
    
    runas /user:Administrator cmd
    
  2. Hide zip or rar files inside an image:
    1
    
    copy /b image.extension+folder.zip image.extension
    
  3. 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.
    
  4. Encrypt files in a folder:
    1
    
    cipher /E
    
  5. Save output of a command to a file:
    1
    
    command >> output.txt
    
  6. Hide a folder from everyone:
    1
    2
    
    attrib +h +s +r foldername
    attrib -h -s -r foldername
    

B. System Information

  1. Display detailed system information:
    1
    
    systeminfo
    
  2. Remove a mounted drive:
    1
    
    subst /d q:
    
  3. Securely copy files between remote hosts:
    1
    
    scp file.txt root@serverip:~/file.txt
    
  4. Change the background and text color in Command Prompt:
1
color 07 [background:text]
  1. Change the prompt text:
1
prompt {text}$G
  1. Map a regular folder as a mounted drive:
1
subst q: c://filelocation
  1. Change the title of Command Prompt window:
1
title {stuff}

C. Network

  1. Curl the weather:
1
curl wttr.in/location
  1. Check your public IP address:
1
curl checkip.amazonaws.com
  1. Curl shortened links to figure out the destination:
1
curl --head --location "https://samurai1337x.github.io/"
  1. Generate a QR code:
1
curl qrenco.de/https://samurai1337x.github.io
  1. Check the status of a website:
1
curl -IsL http://samurai1337x.github.io/ | findstr ^Location

D. Social Media and ChatGPT

  1. 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
  1. Define a word:
1
curl dict.org/d:contretemps
  1. 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

  1. Visit a website:
1
start www.samurai1337x.github.io
  1. Telnet to a server:
1
telnet telehack.com
  1. Delete temporary files to clear space:
1
2
del /q /f /s %temp%\\*
del /s /q C:\Windows\temp\*
  1. View the history of commands:
1
doskey /history

F. Windows Terminal

  1. 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.
  1. Open Terminal from any folder:
1
Shift-right-click on the folder and select Terminal.
  1. 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.
  1. Use PowerShell for advanced tasks beyond Command Prompt.
  2. Get help in the terminal:
1
help

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!

This post is licensed under CC BY 4.0 by the author.