Windows Script Host  

<resource> Element

Isolates textual or numeric data that should not be hard-coded into a script.

<resource id="resourceID">
   text or number


Unique identifier for the resource within the script.


The <resource> element allows you to isolate strings or numbers in your Windows Script (.wsf) file that you want to reference in your scripts. For example, resource elements are typically used to maintain strings that may be localized into other languages.

To get the value of a resource, call the getResource method, passing it the ID of the resource you want to use.

Everything within the elements gets used including white space (tabs, new lines, etc.).


The following code defines a resource (errNonNumeric) and returns its value if the variable upperBound is not numeric.

<resource id="errNonNumeric">
   Non-numeric value passed

<script language="VBScript">
      Function getRandomNumber(upperBound)
         If IsNumeric(upperBound) Then
            getRandomNumber = CInt(upperBound * Rnd + 1)
         End If
      End Function

See Also

<runtime> Element | <named> Element | <description> Element | <example> Element | <object> Element | <package> Element | getResource Method