10 Cool Command Prompt Tricks You Should Know

10 Cool Command Prompt Tricks You Should Know | Cool CMD Tricks | star wars cmd code




01.  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 (like in this example image), 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.
02. Get Help for Any Command
Believe it or not, the help command does not provide help for every Command Prompt command. (How silly is that?)
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.
03. 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.
For example, let's say you're about to post a computer problem to an online forumand 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.
See How to Redirect Command Output to a File for more examples and a better explanation of how to use redirection operators.
04. View a 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 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.
05. 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 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!
06. Open the Command Prompt From Any Location
If you've ever worked in the Command Prompt for very long, you know that it can be really frustrating executing the cd/chdir command over and over (and over) again to get to the right directory you want to work from.
Fortunately, there's a super easy Command Prompt trick that will let you open a Command Prompt window from whatever folder you're viewing in Windows.
All you have to do is navigate, in Windows, to the folder you'd like to start working from once in Command Prompt. When you're there, hold down the Shift key while you right-click anywhere in the folder.
Once the menu pops up, you'll notice an entry that's not usually there: Open command window here.
Click that and you'll start a new instance of the Command Prompt, ready and waiting at the right location!
If you're a Command Prompt power user, you'll immediately recognize the value in this little trick.
07. Drag and Drop For Easy Path Name Entry
Most Command Prompt commands require you, or have options, to specify full paths to files or folders, but typing out a long path can be frustrating, especially when you miss a character and have to start over.
For example, in Windows 10, the path to the Accessories group in my Start Menu is C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories. Who wants to type that all in manually? I don't.
Fortunately there's a Command Prompt trick that makes this much easier: drag and drop.
Just navigate to the folder you want the path for in Windows Explorer. Once there, drag the folder or file to the Command Prompt window and let go. Like magic, the full path is inserted, saving you a considerable amount of typing depending on the length and complexity of the path name.
Note: Unfortunately, the drag and drop feature does not work in an elevated Command Prompt. At least you learned a few tricks back how to open one of those a bit quicker!
08. View Your Computer's Important Network Information
Maybe just for your own information, but certainly when you're troubleshooting a network or internet problem, you'll probably at some point need to know details about your computer's network connection.
Everything you'd want to know about your network connection is available somewhere in the Control Panel in Windows, but it's much easier to find, and much better organized, in the results from the ipconfig command.
Open Command Prompt and execute ipconfig /all.
What displays on screen next is everything important about your network connection: your IP address, hostname, DHCP server, DNS information, and much, much more.
Combine this hack with the one about redirection operators that you learned about several slides back and you've got a very easy way to get information about your connection to someone helping you with a problem.
09. Find a Website's IP Address
Like to know the IP address of a website? You can use the nslookup command or the ping command, but the former is probably faster.
First, let's use the nslookup command to find the IP address of lifewire.com:
Just execute nslookup lifewire.com and view the result. Make sure you don't confuse any private IP addresses that also show up in the nslookup results alongside the public IP address of lifewire.com, which is what IP address we're after.
Now let's try using the ping command to find it:
Execute ping lifewire.com and then look at the IP address between the brackets in the first line shown. Don't worry if the ping command "times out" during execution; all we needed here was the IP address.
You can use the same procedure with any website or any hostname on your local network.
10. Watch Star Wars Episode IV
Yes, you read that correctly, you can watch an ASCII version of the full Star Wars Episode IV movie right in the Command Prompt window!
Just open Command Prompt and execute telnet towel.blinkenlights.nl. The movie will start immediately. Check out the tip below if this doesn't work.
True, this isn't a terribly productive use of the Command Prompt, nor is it really a trick of the Command Prompt or any command, but it sure is fun! I can't imagine the work that went in to this!
Tip: The telnet command isn't normally enabled in Windows but can be turned on by enabling Telnet Client from Windows Features in the Programs and Features appletin Control Panel. If you'd rather not enable Telnet but would like to see the movie, you can also watch it in your browser at Star Wars ASCIIMation.
10 Cool Command Prompt Tricks You Should Know 10 Cool Command Prompt Tricks You Should Know Reviewed by Tecnology Funky on November 01, 2017 Rating: 5

No comments:

Powered by Blogger.