CMD TRICKS AND HACKS

Command Prompt is one of the most powerful tools in Windows; but sadly, it is also the most ignored one. Things were not always like this; but with the advent of GUI based operating systems, people started feeling that computing through command based tools was boring. This ultimately lead the command prompt into obscurity.

However, the command prompt is not useless. In fact, it can be pretty useful. This article provides some excellent tricks, secrets and hacks that will make you realize that the Windows Command Prompt is not only useful but also a tool that you should definitely give more respect to.The Windows Command Prompt tool, and many of its commands, might seem boring or even relatively useless at first glance, but as anyone who has ever used the Command Prompt very often can tell you, there's much to love!


Below are several Command Prompt tricks and other Command Prompt hacks that I guarantee will get you excited about many of the mundane sounding Command Prompt commands like telnet, tree, or robocopy... okay, robocopy sounds pretty cool.


Some of these Command Prompt tricks and hacks are special features or uses of the Command Prompt itself, while others are just neat or relatively unknown things you can do with certain commands. Enjoy!



1 -Watch ASCII version of the Star Wars Episode IV movie

Surprised yet? You can watch an ASCII version of the full Star Wars Episode IV Movie right in your command prompt window. Just open command prompt, type a small code and the movie will start playing immediately. Read the complete instructions here.
2- Create Matrix falling code effect

Have you watched “The Matrix”? Of course, you have. Then, you already know what I am talking about. In case you still don't know what I mean, take a look at this image! You can create the same effect in command prompt using just a few lines of code. Head over to this post for instructions.






3- Know your IP address, DNS Server's address and a lot more about your Internet Connection

Command Prompt can even let you know your IP address. Just type ipconfig/ all in the command prompt and press Enter. Along with your IP address and DNS servers, command prompt will also return a ton of information like your host name, primary DNS suffix, node type, whether IP Routing ,Wins Proxy, and DHCP are enabled, your network adapter's description, your physical (MAC) address etc .




4- Know if your neighbours are stealing your Wifi connection



Command Prompt can let you know if someone is connected to your Local Area Connection and using it. Just follow the steps:-

1) Open your browser and visit http://192.168.1.1 or http://192.168.0.1 depending on your router.

2) Find the tab that mentions “Attached Devices” or something similar.

3) Find the computer name, IP address and MAC Address (sometimes called Physical Address or Hardware Address) of your computer using the previous trick.

4 )Compare it with those displayed by your router in Step 2. If you notice some strange devices, then your neighbour has been sneaking in on your internet connection and it is best to set a password.




5- Know if someone is hacking your computer/ Trace a Hacker


Want to know if someone is hacking your computer? Command Prompt can help you find if someone you don't know is connected to your computer stealing private data. Just execute netstat -a and the command prompt will return a list of computers that your computer is connected to. In the results returned, Proto column gives the type of data transmission taking place (TCP or UDP) , Local address column gives the port with which your computer is connected to an external computer and the Foreign Address column gives the external computer you are connected to along with the port being used for the connection. State gives the state of the connection (whether a connection is actually established, or waiting for transmission or is “Timed Out”).




These tricks work on Windows 8, Windows 7, Windows Vista, Windows XP and all previous versions of Windows.

6. Use Ctrl-C to Abort a Command





Just about any command can be stopped in its tracks with the abort command: Ctrl-C.


If you haven't actually executed a command, you can just backspace and erase what you've typed, but if you've already executed it then you can do a Ctrl-C to stop it.


Warning: Ctrl-C isn't a magic wand and it can't undo things that aren't undoable, like a partially complete format command. However, for things like the dir command that seem to go on forever or questions you're asked at the prompt that you don't know the answer to, the abort command is an excellent Command Prompt trick to know.

7. View a Command's Results One Page (or Line) at a Time





Ever run a command, like the dir command, that produces so much information on the screen that it's almost useless? You're not alone.


One way around this is to execute the command in a special way so whatever information is generated is shown to you one page, or one line, at a time.


To do this, just type the command, the dir command for example, and then follow it with the pipe redirection operator and then the more command.


For example, executing dir /s | more will generate the thousands of lines of results that you expect from the dir command, but the more command will pause each page of results with -- More -- at the bottom of the page, indicating that the command is not done running.


Just press the space bar to advance by page or press the Enter key to advance one line at a time.


See Command Prompt Trick #7 below for a different solution to this problem.

8. Run Command Prompt as an Administrator Automatically





Many commands require that you execute them from an elevated Command Prompt in Windows - in other words, execute them from a Command Prompt that's run as an administrator.


You can always right-click on any Command Prompt shortcut and chooseRun as administrator but creating a shortcut to do the same thing can be a huge time saver if you're a frequent Command Prompt power user.


To complete this Command Prompt trick, just create a Command Prompt shortcut on the desktop, enter the shortcut's properties and then select the Run as administrator box located in the Advanced button on theShortcut tab.

9. Become a Command Prompt Power User with Function Keys





The fact that the function keys actually do something in the Command Prompt is maybe one of the best kept secrets about the tool:


F1: Pastes the last executed command (character by character)

F2: Pastes the last executed command (up to the entered character)

F3: Pastes the last executed command

F4: Deletes current prompt text up to the entered character

F5: Pastes recently executed commands (does not cycle)

F6: Pastes ^Z to the prompt

F7: Displays a selectable list of previously executed commands

F8: Pastes recently executed commands (cycles)

F9: Asks for the number of the command from the F7 list to paste


Command Prompt Trick #17 is full of arrow key shortcuts, a few of which are similar to these function key tricks.

10. Hack the Prompt Text





Did you know that the prompt itself in the Command Prompt is completely customizable thanks to the prompt command? It is, and when I say customizable, I mean really customizable.


Instead of C:\>, you can set the prompt to any text you want, have it include the time, the current drive, the Windows version number, you name it.


One useful example is prompt $m$p$g which will show the full path of a mapped drive in the prompt, alongside the drive letter.


You can always execute prompt alone, without options, to return it to its sometimes boring default.

12. Get Help for Any Command





Believe it or not, the help command does not provide help for every Command Prompt command. However, any command can be suffixed with the /? option, usually called the help switch, to display detailed information about the command's syntax and often times even some examples.


I doubt that the help switch is the coolest Command Prompt trick you've ever heard of, but it's hard to disagree that it's one of the more useful.


Unfortunately, neither the help command nor the help switch offer much in the way of explaining how to interpret the syntax. See How To Read Command Syntax if you need help with that.

13. Save a Command's Output to a File





An incredibly useful Command Prompt trick is the use of redirection operators, specifically the > and >> operators.


These little characters let you redirect the output of a command to a file, giving you a saved version of whatever data the command produced in the Command Prompt window.


Let's say you're about to post a computer problem to an online forum, like my computer support forum for example, and you want to provide really accurate information about your computer. An easy way to do that would be to use the systeminfo command with a redirection operator.


For example, you might execute systeminfo > c:\mycomputerinfo.txtto save the information provided by the systeminfo command to a file. You could then attach the file to your forum post.


See How To Redirect Command Output to a File for more examples and a better explanation of how to use redirection operators.

14. View Your Hard Drive's Entire Directory Structure





I think one of the neatest little commands is the tree command. With tree, you can create a kind of map of your computer's directories.


Execute tree from any directory to see the folder structure under that directory.


Tip: With so much information, it's probably a good idea to export the results of the tree command to a file. For example, tree /a > c:\treeresults.txt, just as explained in Command Prompt Trick #7.

15. Copy From the Command Prompt9. Customize the Command Prompt Title Bar Text





Tired of that Command Prompt title bar text? No problem, just use the title command to change it to whatever you like.


For example, let's say your name is Maria Smith, and you want to express your ownership of the Command Prompt: execute title Property of Maria Smith and the Command Prompt's title bar will change immediately.


The change won't stick, so the next time you open Command Prompt the title bar will be back to normal.


The title command is usually used to help give a custom appearance in script files and batch files... not that I'm saying titling it with your name isn't a good idea!





As you may or may not know, copying from the Command Prompt is not as easy as copying from other programs, which is part of the reason why saving a command's output to a file, Command Prompt Trick #7, is so handy.


But what if you do just want to copy a short section of text to the clipboard? It's not too hard but it's not very intuitive either.


Right-click anywhere in the Command Prompt window and choose Mark. Now, highlight with your left mouse button whatever you'd like to copy. Once your selection is made, press Enter.


Now you can paste that information into whatever program you'd like.
Open Command Prompt From a Folder


Have you ever opened the command prompt and entered endless cd commands trying to get to a folder ? If the answer is yes then you will pleased to know that you can actually save a lot of time by opening a command prompt within a folder from Explorer. All you have to do is hold shift while right-clicking on a folder and the option will appear in the context menu.