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:
- Open notepad and enter this text : “COMMAND.COM”
- 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 www.google.com
tracert – traces the route taken by a packet of data to reach the destination machine
usage : tracert www.gmail.com
tree – displays the structure of the directory in a visual format. Use the /f attribute to also show the files.
usage : tree /f
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 :
- Use the ctrl + c combination to stop a command mid-way.
- 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
- 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