Windows Scripting
  Home arrow Windows Scripting arrow Page 5 - Overview Of The New Windows Scripting Host...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Overview Of The New Windows Scripting Host 5.6
By: Norbert Cartagena
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    2003-09-22

    Table of Contents:
  • Overview Of The New Windows Scripting Host 5.6
  • Are You Ready?
  • Heeeeeeeere's Your Host.
  • New Contestants, Come On Down!
  • Let's Get This Show On The Road
  • Example Scripts
  • Roll The Credits

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Overview Of The New Windows Scripting Host 5.6 - Let's Get This Show On The Road


    (Page 5 of 7 )

    There are two programs that we'll be dealing with in the following sections. The first is WScript.exe, which is the graphical version of WSH. It provides a standard Graphical User Interface (GUI) to set properties. The second is its command-line cousin, CScript.exe, which uses switches (such as //I and //B) to do the same thing. The differences between the two programs are more than just the difference between getting the output from a pop up window or a command prompt. In fact, there are certain advantages to both, which I'll discuss shortly.

    As far as WScript.exe is concerned, there's not really much to tell. To see a script's properties you do what you always do to check the properties of a file: Right click on the file -> Properties. What you will notice is that in FAT and FAT32 environments you'll only get two tabs (General and Script), while in NTFS environments you'll get a third (Summary) and possibly a fourth (Security), depending on your configuration. When properties are set on a script, a text file by the name of the script and with a .wsf extension is created. This file is used as a control file for the scripts settings and can be used to launch the script.

    A bit more interesting is the CScript.exe file, which you'll need to run from a command prompt. The syntax of the command is as follows:

    cscript [scriptname.extension] [options...] [arguments...]

    Under most circumstances, of the three bracketed options, only the script name is required. Just typing cscript will display the command page. Speaking of which, here's the list of commands:

    //I
    Default setting: Interactive mode (opposite of //B)

    //B
    Batch mode: Suppresses script errors and prompts from displaying.

    //D
    Enables active debugging.

    //E:Engine
    Use a certain engine for executing scripts. This is useful because it allows you to run scripts with custom file name extensions. Example: cscript

    //E:vbscript test.admin
    The advantage of doing this is that it guards against accidentally double clicking and running a script you didn't want to run.

    //Job:xxxx
    Executes a WSF job

    //T:nn
    Time out in seconds. Maximum amount of time a script is allowed to run (default is indefinitely).

    //logo
    Default: displays a logo banner.

    //nologo
    Suppresses the logo banner. This is often used by scripts that output to a file which needs to be parsed or used as the control document for another script.

    //H:cscript
    Changes default to CScript.exe.

    //H:wscript
    Changes default to WScript.exe (this is the default).

    //S
    Save the command line options. For example, if you never want to see the logo, then you would type the following: cscript hello.vbs //nologo //S.

    As I mentioned before, there are certain advantages to using either the GUI or CLI versions of WSH. The biggest advantages are in favor of the CLI (CScript.exe), which allows you to exercise greater control over how a file should be run and interpreted. Running scripts under CScript enables them to run an external program and retrieve the output from the program. The biggest advantage of the GUI is that it doesn't take more than a twitchy finger to launch a script which will show you your output in a nice little pop-up box. Unfortunately, this becomes annoying when you have a script which is intended to prompt hundreds of times, such as an event log script. Instead, CScript neatly displays retrieved data in a command window.

    More Windows Scripting Articles
    More By Norbert Cartagena


     

    WINDOWS SCRIPTING ARTICLES

    - Reading and Printing Word Documents in WSH
    - Scripting Microsoft Word
    - Using WSH to Catalog MP3 Files
    - Reading MP3 ID3 Tags in WSH
    - A Brief Look at Menus in WPF
    - More Examples of Simplified Image Processing...
    - Completing a WPF To-Do List Application
    - Simplified Image Processing in GDI+
    - Data Converstion and Task Addition with WPF
    - Adding Controls to an Application with WPF
    - A Portable Scripting Toolbox
    - WPF Through an Example: Introduction
    - Beginning SharePoint Web Part Development
    - More Alternative Languages for WSH
    - WPF Control Layout





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT