You can record specific settings for each of your individual scripts by means of a Windows Script Host control (.wsh) file. The .wsh file is a text document in which you can customize execution of one or more of your scripts. It is created automatically when you set the properties for a supported script file.
If you create multiple .wsh files for a single script, you can tailor the way the script runs to the needs of specific groups or even individuals within an organization. For example, you could create a single logon script that is invoked by two different .wsh files that contain different settings and parameters.
When you double-click a .wsh file or run it from the command line, CScript.exe or WScript.exe reads the .wsh file to determine the specific settings that should be used to execute the script. CScript/WScript executes the original script, passing in the properties that are defined within the .wsh file.
To create a .wsh file for a given script
A .wsh file is created with the same name as the script file you selected.
The following example illustrates a typical .wsh file:
[ScriptFile] Path=C:\WINNT\Samples\WSH\showprop.vbs [Options] Timeout=0 DisplayLogo=1 BatchMode=0
The path information in the [ScriptFile]
section identifies the script file that is associated with the .wsh file. The keys in the [Options]
section correspond to settings in the Script tab within the Properties dialog box.
Note You must have the original script file present when executing the .wsh file. If the .wsh file fails to run the script, check the Path=
information in the .wsh file to ensure that it points to the script you are attempting to run.