The Finest Hand-Selected Downloads
Individually reviewed & tested
Store News

Essential command prompt tools: defrag

30 October 2009, Mike Williams

commandSome people think the Windows command prompt is just for geeks and programmers, and everyone else can get on much better by pointing and clicking their way through the regular Windows interface. But this isn’t entirely true. There are many useful Windows functions that can’t be carried out at all unless you use the command prompt, and once you learn the basics then they’re not at all difficult to use – anyone can do it.

Take disk defragging, for instance, rearranging your hard drive’s files so they’re able to be accessed more quickly. In Windows Vista you can defrag a drive from Explorer by right-clicking, then selecting Properties > Tools > Defragment Now, but you won’t get the option just to analyse the drive to see how defragmented it is. Windows gives you no control over the defrag process, either, and may refuse to run defrag at all if you’re short on hard drive space. These issues could be a real inconvenience, but you can resolve them all just by turning to the command prompt.

How does it work? This is easier to figure out than you might think. Click Start, type Command, then right-click the Command Prompt link and select Run As Administrator to launch it with the full security rights defrag requires.

Next, click in the command prompt window, then type defrag -? and press [Enter]. The “-?” option tells the command line version of defrag to display help information, and it’ll give you a list of all the other commands it accepts.

One of these is “-a”, which tells defrag to carry out an analysis of your drive. Vista’s standard defrag tool can’t tell you how defragmented a drive might be, but from the command line it’s easy: just type something like defrag c: -a and press [Enter] for a quick report. Or you could add the -v “verbose” command for the in-depth details: defrag c: -a -v (replacing c: with whatever drive letter you’d like to use).

By default Windows Vista only tries to defragment file portions that are smaller than 64MB, as they have the greatest affect in performance. The standard interface provides no way to change this, but from the command line it’s straightforward: type defrag c: -w then press [Enter] and the program will immediately go to work.

If you’re short on hard drive space then defrag may not work at all, as it takes much longer to run. But if you’ve time to spare, then again the command line has what you need in its “-f” command. Type defrag c: -w -f then press [Enter], and defrag will run no matter how little free space you have. It might take a while, though, so we’d recommend running it overnight.

Windows 7 users will find even more interesting defrag options available. They can get feedback on the process of an operation with the /u command, for instance, so something like defrag c: /a /u will report “10% complete”, “20% complete” and so on as the analysis progresses.

And best of all, the Windows 7 defrag has a /m command that tells it to work on multiple drives simultaneously, in the background, so the process should finish much more quickly. Just entering defrag c: d: /m /u , for instance, would defrag drives C: and D: in parallel, while keeping you regularly updated with how the process is going.

The defrag command alone has plenty of options to keep you interested, then, but it’s just one of many command line tools that can add useful functions and features to your PC. In the next few weeks and months we’ll explore some of the best and explain how they can help make your Windows life easier.

Your Comments & Opinion

43,445,200
Downloads
Secure & Tested Software
6,454
Reviews
Instant Download 24/7
312,993
Members
10+ Years of Service