Langa Letter: Make Windows XP Self-Maintaining - InformationWeek
Software // Enterprise Applications
11:18 PM
Fred Langa
Fred Langa

Langa Letter: Make Windows XP Self-Maintaining

Fred Langa explains how to automate Windows XP tools and tasks that normally require manual intervention.

Automated, Unattended Defragmentation
The normal, manual way to run Defrag is to click to Start/Control Panel/Performance and then select "Rearrange items on your hard disk to make programs run faster." All those clicks, and all that verbiage, simply starts the Defrag.Exe program (usually located in the Windows/System32 folder). When you run Defrag this way, it comes up with a graphical front end that requires still more pointing and clicking to make anything actually happen. So, this approach is useless for automated defrags when no one will be there to point and click as needed.

You get the same results if you search for "Defrag" in XP's help file: The primary search results ("Using Disk Defragmenter" and "Disk Defragmenter") offer links to the graphical, manual version of Defrag.

But Defrag can run just fine with no graphical front end at all and that's the key to using it in an automated fashion. To use Defrag (and other, similar system tools) this way, you launch the tool via a command line plus any "switches" you want to use to modify the file's behavior. (If you're not familiar with these terms, don't worry:)

To see how simple this really is, open an empty XP "command window": Click to Start/Run and then type the word "command" (without the quotes) in the Run line, and click OK. A command window, usually a mostly black box, will open. There'll be a blinking prompt at the end of a line of text. The text indicates your location within your hard drive's folder structure; and the blinking prompt shows you where anything you type will be entered. You can type any valid XP command there and XP will perform the action. You also can launch programs by typing the name of the tool, and that's what we're interested in here.

Almost all command-line tools offer simple, built-in help that you access simply by adding " /?" or " -?" (without the quotes) to whatever command or tool you're trying to learn about. For example, we're interested in Defrag here, so type DEFRAG /? (note the blank space after DEFRAG) and hit enter. This calls up simple help about Defrag in the form of a list of available Defrag options, and a template showing you how to enter Defrag commands in the correct format and order.

Using the Defrag help text as a guide, you can see that manually triggering Defrag is simplicity itself: The command "DEFRAG C:" (without the quotes) would tell Defrag to work on your C: volume or drive, for example. "DEFRAG D:" would tell Defrag to work on the D: drive. "DEFRAG C: -a" would tell Defrag to analyze how much your C: drive is fragmented, but not to actually perform a defragmentation. And so on.

In fact, if you type DEFRAG C: now, and hit enter, Defrag will run. But don't do it yet, because we're looking to automate the process, not to run it manually.

2 of 5
Comment  | 
Print  | 
More Insights
Newest First  |  Oldest First  |  Threaded View
How Enterprises Are Attacking the IT Security Enterprise
How Enterprises Are Attacking the IT Security Enterprise
To learn more about what organizations are doing to tackle attacks and threats we surveyed a group of 300 IT and infosec professionals to find out what their biggest IT security challenges are and what they're doing to defend against today's threats. Download the report to see what they're saying.
Register for InformationWeek Newsletters
White Papers
Current Issue
2017 State of Data and Analytics
Today's companies are differentiating themselves using data analytics, but the journey requires adjustments to people, processes, technology, and culture. 
Twitter Feed
InformationWeek Radio
Archived InformationWeek Radio
Join us for a roundup of the top stories on for the week of November 6, 2016. We'll be talking with the editors and correspondents who brought you the top stories of the week to get the "story behind the story."
Sponsored Live Streaming Video
Everything You've Been Told About Mobility Is Wrong
Attend this video symposium with Sean Wisdom, Global Director of Mobility Solutions, and learn about how you can harness powerful new products to mobilize your business potential.
Flash Poll