Windows Script Host enables you to run scripts from the command prompt. CScript.exe provides command-line switches for setting script properties.

Procedures

To run scripts using CScript.exe

  • Type a command at the command prompt using the following syntax:

     CopyCode imageCopy Code
    cscript [host options...] [script name] [script options and parameters]

Host Options enable or disable various Windows Script Host features. Host options are preceded by two slashes (//).Script name is the name of the script file with extension and necessary path information, for example, d:\admin\vbscripts\chart.vbs. Script options and parameters are passed to the script. Script parameters are preceded by a single slash (/).

Each parameter is optional; however, you cannot specify script options without specifying a script name. If you do not specify parameters, CScript displays the CScript syntax and the valid host parameters.

CScript Example

Several sample scripts, which are installed along with Windows Script Host, are also available for download at (http://msdn.microsoft.com/scripting).

Suppose, for the purposes of this example, that you have copied the Chart.vbs sample script to the following folder on your computer:

 CopyCode imageCopy Code
c:\sample scripts\chart.vbs

You can run the script with and without a logo as follows.

To run a script with or without a logo

  1. Start the MS-DOS command prompt.

  2. Enter the following commands at the command prompt (modify accordingly if your sample scripts are located in a different folder):

     CopyCode imageCopy Code
    cscript //logo c:\"sample scripts"\chart.vbs
    cscript //nologo c:\"sample scripts"\chart.VBScript

See Also

In Vbsedit, you only need to press F1 to get Help for the keyword under the cursor!


Download Now!



Download   Home  

Copyright © 2001-2024 adersοft