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

Best Command Prompt Tricks

Print Friendly and PDF




Command Prompt IconCommand 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





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.



    1. Graphical structure of drive or path.





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.

 

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 .


  • Getting help via CMD




 

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.


  • Running more than one Command simultaneously.




 

You could use && to do such sort of things. Try whoami&&hostname.


  • Hide/Unhide Files/Folders.




 

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.



Eg. If I want to hide a folder named pics in E: drive , then the command goes as "attrib +s +h E:pics".

  • To unhide just type "attrib -s -h File-Location".


 
Recommended Reading : VLC media player tricks

 


  • Aborting a command in its tracks.




 
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.


  • Use Function keys to increase your speed and help you come out of writing same commands again and again.




 

Function Keys











































Function KeyApplication
F9Asks 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)

 


  • Opening command Prompt from any location.




 
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.


  • Tired of typing long paths in Command Prompt.




 
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.


  • Shutdown or Restart another Computer




 
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.


  • Make Your Keyboard type a message continuoulsy [VBS Trick]




 

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")
do
wscript.sleep 100
wshshell.sendkeys "This is a Virus. You have been infected."
loop

For fun you could send this file as an email attachment.


  • Create a Virus that ejects CD/DVD/BD drives continuously [VBS Trick]




 

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

Double click to open this file and see the magic.


  • Display a Funny Message containing Reason for Shutdown.




 

Execute shutdown -s -t 500 -c "Skynet has become Self Aware. John Conor Can't Stop me. YOu can't use your PC anymore."


  • Find hidden Files and Folders.




 
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