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.
Building A Mobile Business MindsetAmong 688 respondents, 46% have deployed mobile apps, with an additional 24% planning to in the next year. Soon all apps will look like mobile apps – and it's past time for those with no plans to get cracking.
Top IT Trends to Watch in Financial ServicesIT pros at banks, investment houses, insurance companies, and other financial services organizations are focused on a range of issues, from peer-to-peer lending to cybersecurity to performance, agility, and compliance. It all matters.
Join us for a roundup of the top stories on InformationWeek.com for the week of September 18, 2016. We'll be talking with the InformationWeek.com editors and correspondents who brought you the top stories of the week to get the "story behind the story."