<unnamed> Element
Describes an unnamed argument for the script.
<unnamed
name = unnamedname
helpstring = helpstring
many = boolean
required = boolean or integer
/>
The <unnamed> element is contained by (enclosed within) a set of runtime tags.
An argument with the name server would provide a /server argument at the command line and an argument named server in the WSHNamed arguments collection.
Note:
|
|---|
|
The name attribute of the unnamed element is just for display purposes. |
When setting the required attribute, a Boolean value is converted to an integer; "true" becomes 1 and "false" becomes 0.
Here are a couple of examples of how the various attributes affect the usage with unnamed elements. First, a simple case:
<job> <runtime> <unnamed name="filename" helpstring="The file to process" many="false" required="true" /> </runtime> <script language="JScript"> WScript.Arguments.ShowUsage(); </script> </job>
This produces the following:
Usage: example.wsf filename Options: filename : The file to process
In the next example, change the code as follows, changing required to 3:
<runtime> <unnamed name="filename" helpstring="The files to process" many="false" required="3" /> </runtime>
Your output changes to:
Usage: example.wsf filename1 filename2 filename3 Options: filename : The files to process
The many argument displays ellipses to indicate you can enter more files than indicated. In this final code example, change your code as follows:
<runtime> <unnamed name="filename" helpstring="The file(s) to process" many="true" required="1" /> </runtime>
The output changes to:
Usage: example.wsf filename1 [filename2...] Options: filename: The file to process.
Note: