The Windows command line is very fruitful, loaded with features and commands that give you an impressive amount of control over your operating system. Unfortunately, the transition from the command line to the desktop is one of the things stopping people from using it. Linux users benefit from their terminals much more than Windows users because of this. There are, however, many command line conventions that people don’t usually cover and would lead to a seamless desktop/cmd experience. Let’s have a look at a few of these, shall we?
1. Receive Output Right On Your Clipboard
One of the biggest complaints I had about the command line is the inability to easily copy/paste things from within the command line into desktop applications. This annoyance makes many people steer clear of anything to do with the command line and has become one of the biggest pet peeves to some Windows geeks. Little do they know that they can simply copy whatever the command line outputs via the “clip” switch. Let’s copy the list of files in the current directory onto the clipboard:
If you don’t know what that separator was, it’s a pipe. You can reach that by typing “Shift” and the backslash key (usually situated to the left of “Enter”).
2. Output To A File
So, someone asks you to send the contents of a command as an attachment via email. How do you solve this issue? Perhaps you want to edit the contents before you paste them onto a window. The best way to do this is to output the contents of a command’s results into a file. Similar to the “clip” switch, this is something that requires a bit of extra typing after the command. Let’s try and copy the list of files within the current directory into a text file:
That was very simple, wasn’t it? Don’t forget to put quotation marks around the file path if you have spaces in the name!
3. Show Your Command History
One quick way, both in Windows and Linux, to show your last command is to press the “up arrow” key on your keyboard. But if you type a bunch of commands, you really don’t want to be pressing that key repeatedly until you get to what you’re looking for. Well, that’s why you type “doskey /history.” Let’s see how that looks like for a second:
Just like viewing your browser history, it shows you every command you typed right down to the letter. This way, you don’t have to do any useless navigating with the arrow keys.
4. Run Several Different Commands At One Time
This might come as a surprise to you if you’re new to the command line, but there are ways to execute multiple routines in one shot. Let’s say that you want to see your IP at the same time as you’d like to see what connections your computer is making. You can get rid of the extra space caused by initiating a new command twice by executing both in one single line. Let me show you what I mean:
The “&&” conjoins any two commands. I just looked for my IP and directory structure. The directory structure will appear below all the Ethernet adapters on my server (a lot!).
The Best Part
Did you know that you can combine anything you learned here within the command line? Try typing
ipconfig && dir > C:\file.txt
This will execute both commands and print their output into a file. Let us know if this helped you in the comments section! If you have any other tricks to share, don’t hesitate to do so!
Receive the latest update in your inbox.
Or connect with us: