In this article we will have a quick look at some of the Unknown Command Prompt tricks that can help you perform some of the tasks without having to switch to the windows explorer.

Command Prompt is the dark side of windows and is not much used by home users and beginners, but once you get used to some of these commands you will realize the power of Command Prompt.

Launching Command Prompt

We have to first launch command prompt to get started, so let’s look at the different ways to launch it.

  • The easiest and most known way to launch command prompt is using the command CMD on the run window.
  • The second easiest way is using the SHIFT key. Hold the SHIFT key and right click inside any folder to get the Open Command Window Here option in the context menu.
  • The least known way is using the F4 key. When you are inside a folder, just press F4 which will place your cursor on the windows explorer address bar. Erase the path and just type CMD in the address bar which will launch command prompt pointing to the current path you were in windows explorer.

START Command

We know how to open command prompt from a windows explorer how about doing it the other way?

If you are in a command prompt you can actually open up a folder in windows explorer using the START command.

Example: START <foldername>

For folder names with spaces you have to use the command as shown below,

START “” “Folder Name with Space”

You also just type START command alone to launch a new command prompt.

Auto complete using TAB key

When you use commands like CD & DIR you need to supply the file name as a parameter. Instead of typing them you can use the TAB key to cycle through the files in the current folder. For example type CD and hit space, now start typing the first letter of the folder or file and then hit TAB key to loop through all the files/folders that starts with the letter you specified.

Export Command Prompt Results

Some of the commands that you use inside command prompt will actually give you a big chunk of results and it’s often needed for some other purposes.

You can right click inside the command prompt and click Mark and select the text to copy it, but there are better ways to do it as shown below:

  • <CMD command> | Clip

When you use | Clip with any command it saves the result in clipboard without displaying it on screen.

Note: | Clip works on PowerShell commands too.

  • <CMD command> > filename

The redirection operator > or the commonly known greater than symbol can actually export the results of your command to a text file that you specify.

  • Type CMD | Clip and type the commands that you want to execute. After entering all the commands type EXIT. The results of all the commands that you executed will be copied in clipboard and you can paste them in a notepad.

View File Contents on Command Prompt

TYPE <filename>

Use the TYPE command to view the contents of a file in the command prompt itself without having to open it from the windows explorer.

Use && to run more than one command in a single line

When you want to execute more than one command in a single line use the && operator.

Example: hostname && whoami

The above command will display both your computer name as well the logged in user name.

Command Prompt Calculator

SET is a very well-known command among programmers to view the current environment variables that are set in a computer. If you just type the command SET and hit enter, you can see the environment variables values of your system.

You can use the same SET command with the /a parameter to perform arithmetic calculations in command prompt.

Try executing the following in command prompt: SET /a 13*13

Did I tell you that SET command also returns the Decimal Value for a Hexa Decimal value that you specify?

Example: SET /a 0xD will return the decimal value 13 :-)

SORT Command

As the name indicates SORT command actually helps you to sort the contents of a file quickly. If you want to sort a huge list of names quickly then you can use this command.

Example: SORT C:\Users\Administrator\Desktop\LetsSort.txt

You can also sort a list of names without specifying a file. Just type SORT and hit enter; now start typing words one line each and hit enter. Once you are done finally press CTRL + Z and the words will be sorted for you on screen.

FIND Command

FIND command helps you to find a word or sentence in a file and return the value back to you on screen if found.

Example: FIND “articpost” C:\Users\Administrator\Desktop\LetsSort.txt

SORT and FIND commands

If you are looking for some regular expression support then you can use the FINDSTR command.

TREE Command

TREE Command gives you a visual representation of the folder structure inside folders or drive. Use the MORE command to avoid the overflow that can occur due to large output.

Example: TREE | MORE

So do you have any cool unknown command prompt tricks in store? If yes, do share it. I will be happy to learn it from you :-)