meta expr:content='data:blog.pageTitle' property='og:title'/>

Best Command Prompt Tricks

Print Friendly and PDF

Command Prompt Icon
Command prompt could be used to do some amazing things with just a few characters while without command prompt it would take lot of time to do same thing via GUI.
Command prompt is not much popular among users because:

  1. They are having another, much simpler way to do it via GUI, but it takes time.
  2. They don't know exactly, How to use it.

At first glance you might take command prompt as a boring and useless tool, but advanced users could tell you, it makes their life easier.

Starting Command Prompt (CMD)

Keyboard Win+R
  • Press Win+R then type CMD or cmd and hit ENTER.
  • OR
  • Search CMD and open.

Let's try out some cool tricks.

  1. Changing Font and Background Colors

  2. Command Prompt Properties
    Command Prompt Color Settings
    • Just right click on top of command prompt window.
    • Click Properties.
    • Open Colors tab and there you go.
  3. Graphical structure of drive or path.

  4. TREE command
    To get Graphical structure of folders only.Type TREE C: and hit ENTER.
    If you want files to be listed too then type TREE C: /F.
    Above command shows Graphical Strucuture of C: drive but if you want to have Graphical structure of a specific path or such as there's a folder cygwin in C: drive and we want it's structure then type TREE C:/cygwin.
  5. Checking IP address and all.
    ipconfig/all command

  6. The ipconfig/all command gives lots of important information like IP address, DNS Servers, etc. Also you dont have to go online and check your IP address via whatismyIP :D .
  7. Getting help via CMD

  8. If you are confused about any command's application, you could simply ask command prompt for help. Type Command/? here we just append /? at the very end of your command.
  9. Running more than one Command simultaneously.

  10. You could use && to do such sort of things. Try whoami&&hostname.
  11. Hide/Unhide Files/Folders.

  12. NOTE:
    • If you hide files/ folders via this method it, you can't unhide them via GUI.
    • Files or Folders hidden via this method are not even shown when you chose show Hidden files and folders option in Folder view.

    Okay Let's try this out.
    1. Type "attrib +s +h File-Location" and hit ENTER.
    2. Eg. If I want to hide a folder named pics in E: drive , then the command goes as "attrib +s +h E:\pics".
    3. To unhide just type "attrib -s -h File-Location".
    Recommended Reading : VLC media player tricks
  13. Aborting a command in its tracks.

  14. Ctrl+C
    If you mistakenly ran a time consuming command and you want to stop it in its tracks. Use Ctrl+C. Ctrl+C aborts a command but it can't Undo things like Format command.
  15. Use Function keys to increase your speed and help you come out of writing same commands again and again.

  16. Function Keys
    Function Key Application
    F9 Asks for the number of the command from the F7 list to paste
    F8: Pastes recently executed commands (cycles)
    F7: Displays a selectable list of previously executed commands
    F6: Pastes ^Z to the prompt
    F5: Pastes recently executed commands (does not cycle)
    F4: Deletes current prompt text up to the entered character
    F3: Pastes the last executed command
    F2: Pastes the last executed command (up to the entered character)
    F1: Pastes the last executed command (character by character)
  17. Opening command Prompt from any location.

  18. Open Command prompt from any location
    • Navigate to the folder where you want to open Command Prompt.
    • Hold down Shift key and Right click on the folder's name.
    • In the popup you will notice something that's usually not there "Open Command Promt Windows here".

    If you're an advanced user, you'll instantly recognize value of this trick.
  19. Tired of typing long paths in Command Prompt.

  20. drag and drop command prompt
    To get rid of typing long paths Windows introduced a new feature. Drag and Drop.
    Just Navigate to the file/folder whose path you want to use in your command. Once there, Drag and drop the File/Folder to command prompt window.
    Mind it... It saves a lot of time.
  21. Shutdown or Restart another Computer

  22. Remote Shutdown dialog box
    If you were a system administrator in a business environment you'll be doing this all the time.
    Execute shutdown/i command, easiest of all. It opens remote shutdown dialog box. Enter the name of PC, select your choices and click OK.
  23. Make Your Keyboard type a message continuoulsy [VBS Trick]

  24. Open notepad, copy the code given below and save the file as Tricks.vbs, make sure Save as type is all files. You'll need to restart your computer to stop this.
    Set wshShell = wscript.CreateObject("WScript.Shell")
    wscript.sleep 100
    wshshell.sendkeys "This is a Virus. You have been infected."

    For fun you could send this file as an email attachment.
  25. Create a Virus that ejects CD/DVD/BD drives continuously [VBS Trick]

  26. Copy the code given below, paste in notepad and save as Virus.vbs .
    Set oWMP = CreateObject("WMPlayer.OCX.7")
    Set colCDROMs = oWMP.cdromCollection
    if colCDROMs.Count >= 1 then
    For i = 0 to colCDROMs.Count - 1
    For i = 0 to colCDROMs.Count - 1
    End If
    wscript.sleep 50

    Double click to open this file and see the magic.
  27. Display a Funny Message containing Reason for Shutdown.

  28. Execute shutdown -s -t 500 -c "Skynet has become Self Aware. John Conor Can't Stop me. YOu can't use your PC anymore."
  29. Find hidden Files and Folders.

  30. find hidden files and folders command prompt
    Execute dir/ah. This trick would list all the hidden directories and files.

These are Some command prompt Tricks. Let me know via Comments if you like them or if you want any help.

Post a Comment