Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
System administration scripts typically run without displaying a user interface of any kind. This is due to the nature of many of these scripts. For example, you might have a script that runs at 4 A.M., checks the size of all your event logs, and if necessary backs up and clears the logs that are nearly full. Not only would you have little need for a user interface with a script like this, but, even if you provided one, no one would be present to view it.
Many scripts have no need to display a user interface for other reasons as well:
On the other hand, at times the lack of a user interface can be a disadvantage:
In an enterprise setting, it is useful to know which scripts are running on a computer. For example, you might have a script that copies events from an event log. Depending on how the script has been written, it might take an hour or more to complete its task. If so, you probably do not want to inadvertently start a second copy of the script.
Likewise, if the script has stopped responding, you need to know that as soon as possible. That way, you can terminate the process and restart the script. Otherwise, you might wait for over an hour only to discover that the script has failed and must be restarted.
Although scripting languages provide little in the way of user interface elements, you can still track script progress either by taking advantage of Internet Explorer or by using the standard output capabilities of CScript.
It is difficult to track absolute script progress that is, to report that a script is 63 percent complete. Although this is possible in some cases, usually too many variables are involved to enable you to accurately predict when a script will finish. For example, anything from increased network traffic to a new process starting on the local computer can increase the amount of time required to complete a script.
Because of this, the progress indicators used in this chapter do one of two things: They simply note that a script is currently running, or they report relative progress. For example, the progress indicator might note that a connection is being made to a remote computer; after the connection is made, the indicator might note that data is being retrieved. However, no effort is made to estimate how long it will be before data retrieval is complete. Although it is possible to create progress indicators that do this, the code required for the progress indicator would be longer and more complex than the code required to carry out the primary function of the script.
Send us your feedback | « Previous | Next » |