Do you have a scripting-related question or problem? You can send your question or problem to firstname.lastname@example.org.
I'm using the Windows Script Host (WSH) 5.6 <named> element to define a mandatory argument, as the code in Listing 1 shows. However, when I run the script without the mandatory argument, nothing happens. Why doesn't the script produce an error that indicates that the mandatory argument is missing?
You can use the WSH 5.6 <runtime> elements (i.e., <description>, <example>, <named>, and <unnamed>) for script-documentation purposes only. The <runtime> elements provide a structured mechanism that defines instructions for using a script and in no way affect the script's runtime behavior. The only effect the required="true" attribute has on the script is that it controls whether the argument is enclosed inside square brackets in the script's usage instructions. WSH displays an argument marked as mandatory (required="true") without square brackets and an argument defined as optional (required="false") inside square brackets.
You must test whether WSH passes a mandatory argument to the script at runtime and react accordingly. Listing 2 shows how you can use the Exists method, which is part of the WshNamed arguments collection, to check for the existence of a mandatory named argument.