We do love Command Prompt, don’t we? If so, why not learning another set of tips and tricks that you may not know to get more out of it? Let’s take look at them.
Table of Contents
- Tip #1: F7
- Tip #2: Mode to adjust the size of CMD window
- Tip #3: Color to change the default color of CMD
- Tip #4: Tree to show off the folder structure
- Tip #5: RD to completely delete a folder
- Tip #6: Run multiple commands at once
- Tip #7: Tasklist to display the running processes
- Tip #8: Tab to Auto-complete
- Tip #9: Drag & Drop
- Bonus tip
- Related Posts
Tip #1: F7
If you think using Doskey to check the command history is cool, this is even cooler. Simply press F7 and a history of the commands you have used in the same session pops up right in the middle.
Tip #2: Mode to adjust the size of CMD window
Very useful when the output characters extend beyond the 80 characters.
Syntax: mode [width], [height]
It’s hard to have a nice screenshot to demonstrate, but type in mode 120, 25 in the Command Prompt to see what happens.
Tip #3: Color to change the default color of CMD
The color attr is specified by 2 hex digits, the first one presents to the background while the second one responses to the foreground. Each digit can be found by simply typing color /?
Tip #4: Tree to show off the folder structure
Syntax: Tree [drive:][path] [/F] [/A]
By default, it graphically displays the folder structure of a drive or folder. The switch /F will list the files in addition to each folder.
If you want to output the structure to a text file, use /A switch along with the > switch. For example, the following command outputs the structure to a text file named structure.txt
c:\>tree /a d:\users\s184 > d:\temp\structure.txt
Bonus tip: you can also export a Tree view of a specific folder right in File Explorer.
Tip #5: RD to completely delete a folder
Syntax: RD [/S] [/Q] [drive:]path
By default, it only removes a folder that is empty. With a switch /S, you can completely delete a folder that still has files and subfolders. It’s extremely useful when you want to delete folders while you are at the recovery mode with no GUI.
Tip #6: Run multiple commands at once
With “&&” to separate, you can run multiple commands at once from one line. The commands run sequentially from left to right and it breaks if any of the commands fails.
Simple but useless example:
c:\>color fc && dir
Tip #7: Tasklist to display the running processes
It not only lists all running processes on the local system but also displays on a remote computer as well. There are a lot of good use of it. Be sure to use Tasklist /? to find out more. Here are a few good uses of them.
The switch /SVC to list the tasks with services that host them.
The switch /FO is useful when outputting the results in a txt file.
Pipe with Find to narrow down the result.
Tip #8: Tab to Auto-complete
To save your time on typing the whole command, simply press Tab key to cycle through all the files and folders in the current folder. If you type a few keys and then start pressing Tab, it will cycle through files and folders that match what you have just typed. That’s pretty cool.
Tip #9: Drag & Drop
If you are tired of typing the full path of a file or folder, this trick is going to help you greatly.
Exactly, drag any file or folder into the Command Prompt and it will translate into that file or folder’s full path.
Thanks to MakeUseOf for inspiring the ideas for both tip #8 and #9
Before we end here, here is a bonus tip for those who read all the way here. There are 4 command prompt alternatives available for free if you feel that the built-in CMD isn’t good enough.
And that’s it for the day. More to come if you find them useful.