ShowUsage Method

Makes a script self-documenting by displaying information about how it should be used.



WScript Object.

When you run the ShowUsage method, a help screen (referred to as the usage) appears and displays details about the script's command line options. This information comes from the runtime section of the *.WSF file. Everything written between the <runtime> and </runtime> tags is pieced together to produce what is called a "usage statement." The usage statement tells the user how to use the script.

Note Note:

The usage can also be displayed using the /? switch.

The following example demonstrates how to set up usage information in a *.WSF script file.

        <description>This script reboots a server</description>
            name = "Server"
            helpstring = "Server to run the script on"
            type = "string"
            required = "true"
        <example>Example: reboot.wsf /server:scripting</example>
<script language="VBScript">

If WScript.Arguments.Count <> 1 Then
End If


The JScript code for the equivalent script block would be:

if (WScript.Arguments.length != 1)

Calling the ShowUsage method from this script results in the following output:

This script reboots a server
Usage: reboot.wsf /server:value


server : Server to run the script onExample:
reboot.wsf /server:scripting

Community Additions