Wednesday 16 February 2011

10 Amazing Windows Command Line Tricks

Windows Command line
Whatever eye candy the graphical interface of windows may offer but it could never match the functionality that could be achieved with command line. Here we’ve listed 10 useful commands and tricks for Windows command line.

1. Super Hide your files

Besides normal hidden files, windows file system provides another attribute for files that makes them super hidden so that they aren’t visible form explorer or with normal dir command. Use the command
attrib +s +h pathtofile
to super hide a file. Replace + symbol with - to remove super hidden attribute from file.
You can also use this command to show hidden files in usb drives, simply use
attrib -s -h *.* c command.

2. Join multiple mp3 files

Here’s a nice trick that otherwise would require some software to perform. You can join multiple mp3 files to form a single mp3 file. Simply move to the folder in command line where mp3 files are stored that you want to combine and run the command
copy /b *.mp3 newfile.mp3
The wildcard *.mp3 will combine all mp3 files to form a newfile.mp3 file. You can control which files are combined using wildcard parameters.
Here’s a nice trick using this method to embed mp3 file in a jpg image file.

3. Map a Drive Letter to a Folder

Most of the time, our hard drives get filled with huge amount of data folder, files etc that moving to a folder you occasionally use becomes a heck. However, there’s a dos command that lets you map a drive letter to a folder. e.g. to map the folder C:windows to M drive use the command:
subst M: C:Windows
However the mapped drive gets lost once you restart your pc, you can then create a batch fileincluding the above command and schedule it to run at system startup.

4. Change colors of command Window

Perhaps you need to take a print out of dos window and don’t want to waste ink on black backgroundof dos window. Windows command line provides a command to change background and text color of dos window in a snap.
Simply use color bf to change colors. b is the code for background color and f is code for text color. To know color codes type color /? at command line.

5. Use previously entered Command

Just typed a long command moments ago and need to run that again but the effort involved to type again is making you sick! But don’t worry as command line keeps track of your previously entered commands which are accessible by pressing F7 key.
Command History
Alternatively you can use Up Arrow key to use earlier commands you used.
F1 & F2 also offer similar kind of functionality but in a different way, try them out.

6. Run Multiple commands at once

Multiple commands can be concatenated using && and run at once with single press of Enter. Simply type in your commands and concatenate them with && at once.
e.g. color f8 && dir && time
would run all the three commands one after another with a single press of Enter.

7. Filter output of commands

Some commands like systeminfo provide a whole bunch of information about your pc but what if you need info only about updates installed or Processor or Virtual Memory. You can filter the output usingfind. Here’s how to get only updates list from systeminfo.
systeminfo | find "Update"
This will only show updates installed on your system.

8. Drag Drop Folder paths

No need to type in long folder paths at command line, simply drag n drop that file or folder fromexplorer onto command line window to copy its path.

9. Move selected files to another folder

If you need to move only doc files to another folder or project documents created this month to another folder from a folder containing large number of files, you would rather end up using Ctrl+click to select individual file in Windows Explorer. But thanks to command line, you can use wildcards to move selected files.
Use move *.doc newfolderpath
to move only doc files to new folder. Any wildcard combination can be used here.

10. Take screenshots of webpages

To take screenshots of web pages, you would need a tiny utility called IEcapt.exe and then place it in c:Windows directory, now go to command line and type in
iecapt urltocapture pathofoutputimage
to get a screenshot of the webpage.
If you liked this article, then you might find future posts at Technotraits useful, so don’t forget tosubscribe.

No comments:

Post a Comment