Useful CMD tricks and commands

  1. Previous
  2. Next
  3. Recent

    1. Signs 'He' May be Cheating on You
    2. 7 Vows of Hindu Marriage - Know What 'Saat Vachans' Mean
    3. RuPay vs Visa vs Mastercard vs American Express- A Comparison
    4. What is RuPay? Everything You Need to Know About India's Domestic Payment System!
    5. Top 10 Online Portals to Find a High Paying Job in India
    6. Top Indians who Revolutionized the IT Sector in India
    7. 8 Initiatives by Narendra Modi that Could Change the Future of the Nation
    8. 8 Work-from-home Jobs for Housewives, Students, and Part timers
    9. Complete Company Registration Process in India - Explained
    10. Change Name in India in 5 Steps - Filing Affidavit, Newspaper Ad & Gazette Notification

That wretched black window with a broken white font gives more scares than be of any use, right?…Wrong. Though not exactly user-friendly, the Command prompt can sometimes prove to be of help.  First things first. How do you run cmd?
Press the ‘windows-key + r’ combination and type ‘cmd’ in the Run box. But what if the utility is blocked by the administrator? Here’s a workaround:

  1. Open notepad and enter this text : “COMMAND.COM”
  2. Save the file as cmd.bat

And you are done!

Here’s a short list of cmd commands that you might find useful :

assoc – A useful cmd trick. Used to associate file extensions to filetypes. For eg. the following will associate the fictional .gerrard file extension with the html file-type.
assoc .gerrard = htmlfile
Just type assoc file-extension to show current association with that extension.

move – Another very useful cmd command.  What makes this simple command is the combination of wild cards. For eg. if you wanted to move all pdf files from one location to another, you could type:
move *.pdf e:\temp.
Note that if the any directory involved has a space in its name, it needs to be included within the double quotes. Also note that this command does not create a new folder, so the destination directory must already exist.

ping  – used to check the health of the connection.
usage : ping

tracert – traces the route taken by a packet of data to reach the destination machine
usage : tracert

tracert cmd trick

tree – displays the structure of the directory in a visual format. Use the /f attribute to also show the files.
usage : tree /f

tree cmd command

find – Probably the most powerful cmd command. It searches for a specific string of text in one or more files. After searching the specified file or files, find displays any lines of text that contain the specified string.

eg. find /v “gerrard” new2.txt    displays all lines of text in the file new2.txt that does not contain the string “gerrard”. The not operation is applied by the /v attribute.
The command can be made even more powerful by using the pipe (|) operator. Here’s how
To search your hard disk to find and display the file names on drive C: that contain the string “Google” use the pipe (|) to direct the results of a dir command to find as follows:
dir c:\ /s /b | find “Google”

Here are some more useful cmd tricks :

  1. Use the ctrl + c combination to stop a command mid-way.
  2. Use the | operator to break the output into pages.
    eg. after this command is entered, the output is displayed either line by line(by pressing space) or page by page(by pressing enter).
    C:\dir | more

cmd tricks and commands

  1. The “>” operator moves the output of a command to a filename. For eg. the following command saves the output of the dir command to the file new.txt
    c:\dir >new.txt
blog comments powered by Disqus