DBA Scripts Archive for Windows
No Title[an error occurred while processing this directive]
by Jeff Hunter, Sr. Database Administrator
When executing a script in Windows (VBScript or JScript), the default WSH engine is WScript. What does this mean? Well, consider running the script FileList.js on the command-line without specifying the WSH engine (WScript or CScript):
Figure 1: Default WSH Engine
By default, this script will be run using the WScript script host engine. Using WScript, all commands are run through the GUI-based engine and all output will be presented in separate windows. Using command-line tools, this is often not the desirable output type. Most administrators will want to run their scripts through the console based engine, CScript. To perform this, the user can run the script by explicitly calling the script through the CScript script host engine as in the following:
This is a lot of typing to simply run a script using the console script host engine. Notice, that I am also using the //NoLogo option to suppress the Microsoft banner text.
Most often, the administrator will want to change the default behavior of Windows to use the console script host engine (CScript) as the default when the user only types in the script name to run. This can be easily done for the current user using the following command:
Now, let's see how our script gets executed by simply running it from the command-line without specifing the script host engine:
Figure 2: Change Default Scripting Host
Even though it is possible to change the default behavior, it is still highly recommended to run all scripts by explicitly specifying the WSH script host engine. This is recommended since it is possible for any user to change the default WSH script host engine, and you want to ensure that your scripts are being executed using the correct engine under any circumstances.
Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX / Linux server environment. Jeff's other interests include mathematical encryption theory, tutoring advanced mathematics, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 20 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science and Mathematics.
Copyright (c) 1998-2018 Jeffrey M. Hunter. All rights reserved.
All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at email@example.com.
I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.
Last modified on
Friday, 17-Sep-2010 18:12:03 EDT
Page Count: 17758