Converting the Windows Script Host GetResource Method

Definition: Returns the value of a resource defined with the <resource> element.


The GetResource method is reserved for use with Windows Script Files (.WSF files), and is primarily used as a way to localize a script: it enables you to define a set of strings (for example, an error message localized into several different languages) and then retrieve a specific value using an assigned – and unique – resource ID. The initial release of Windows PowerShell does not include anything similar to GetResource. However, the Community Technology Preview (CTP) release of Windows PowerShell 2.0 features a data section that does something similar: it enables you to separate your actual scripting code from resource information such as error messages. For more information about the data section, see the Windows PowerShell online help.

See conversions of other Windows Script Host methods and properties.
Return to the VBScript to Windows PowerShell home page