The best Command Prompt tricks you should know.

These Command Prompt tricks, hacks, and secrets apply one Windows 10, 8, 7, Vista, and XP operating systems.

Use Ctrl-C to Abort a Command

Before we get into these tricks, i think you will need to know how to cancel operations that might take longer to finish execution or suspicious.  By pressing Ctrl-C in a combination, you stop any process going on in your computer.

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.

Ctrl-C isn’t a magic stick and it can’t undo things that aren’t undo-able, 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.

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 text file, giving you a saved version of whatever data the command produced in the Command Prompt window.

For example, let’s say you’re about to send your computer problem to us  through our support email 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.txt to save the information provided by the systeminfo command to that file. You could then attach the file to your forum post.

View a Drive’s Entire Directory Structure

One of the neatest little commands is the tree command. With tree, you can create a kind of map of the directories on any of your computer’s drives.

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

With so much information created with this command, it’s probably a good idea to export the results of tree to a file so you can actually look through it.

For example, tree /a > c:\export.txt, just as explained in the last Command Prompt trick about redirection operators.

Customize the Command Prompt Title Bar Text

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

For example, let’s say your name is Christopher Twehanagane, and you want to express your ownership of the Command Prompt: execute title Property of Christopher Twehangane 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 titling it with your name isn’t a good idea! Own your stuff.

Copy Text From the Command Prompt

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, which you learned above is so handy and challenging.

However, what if you do just want to copy a short section of text to the clipboard?

  1. Right-click anywhere in the Command Prompt window and choose Mark in the options pane.
  2. Highlight with your left mouse button what you would like to copy.
  3. Right-click once.

Now you can paste that information into whatever program you’d like, just like you paste other text.

 

WhatsApp Let's chat