Fred Langa explains how to address problems with Windows XP automation, looking at XP's self-maintenance tools and techniques.
In "Make Windows XP Self-Maintaining", we discussed how to automate Windows XP tools and tasks that normally require manual intervention. This involves three steps: (1) finding the right text command(s) and modifiers to launch the maintenance tool or process that you want, in the way you want; (2) building a simple script or batch file to issue the command; and (3) using Task Scheduler to execute the script or batch file at the desired times. (This is, of course, a highly compressed explanation. Please see the original article for the full detail.)
But there are cases where this automation method won't work as intended or may prove unwieldy. For example, XP's Backup applet is one of the most configurable--and thus most complex--of that operating system's built-in maintenance tools. A command to launch the Backup applet with all the normal options can involve well over 300 characters' worth of obscure shorthand data, each element of which must be in precisely the correct position, format, and sequence. It's way too much data to try to figure out and enter accurately by hand.
There can be other automation troubles, too, including very common problems with permissions and passwords for scheduled maintenance events.
And sometimes, XP gets in its own way. For example, the XP Backup applet comes with a "Wizard" to simplify its use, but on its own, the Wizard produces a standalone task that may not integrate well with other maintenance tasks. If Backup is the only task you want to run, then there's no problem, but if you want to perform a more-complicated series of maintenance tasks, you may run into serious trouble:
Let's say you want to have your PC automatically wake itself up every day at 3 a.m., clean up your hard drive, back up all your files, defrag every disk or partition in your system, and then go back to sleep. If you use only XP's built-in Backup Wizard, you'll have no simple way of ensuring that your backups will run the way you want--after the cleanup but before the defrag. You're basically forced to guess when to launch Wizard-generated maintenance tasks, hoping you've allowed enough time in between. Of course, if you guess wrong, two or more tasks may end up competing for the hard drive at the same time. In some cases, tasks that compete this way may never run to completion. This, in fact, is the major limitation of the Backup Wizard and similar crude schedulers: Your tasks exist largely in isolation, rather than being smoothly integrated into your overall maintenance procedures.
"Make Windows XP Self-Maintaining" showed how a script or batch file can correctly sequence a whole series of maintenance tasks, helping to ensure that one task finishes before another begins. But handcrafted scripts and batch files can have their own limitations, too, especially when you're talking about automating a tool like Backup that may require an enormously complex command line hundreds of characters long.
The solution is a hybrid approach: Use a tool like the Backup Wizard to generate the complex command line you want, then lift that command line and use it in your own simple scripts or batch files. That way, you get all the power and ease of the Wizard approach but all the flexibility and proper sequencing of the script or batch file approach.
This works not only for XP's Backup applet but also for many other complex tools and utilities that have a Wizard or similar front end that integrates with Task Scheduler. You can lift the automatically generated command line out of Task Scheduler to use as you see fit in your own custom scripts and batch files. It's easy and opens up incredible power to you.
This may sound confusing, but seeing a specific example (we'll use Backup as our case in point), will make everything clearer.
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.
Join us for a roundup of the top stories on InformationWeek.com for the week of April 24, 2016. We'll be talking with the InformationWeek.com editors and correspondents who brought you the top stories of the week!