Microsoft® Windows® Script Host Setting Script Properties |
WSH Tutorial Previous Next |
For each individual script you run, you can record specific settings by means of a control (.wsh) file. A .wsh file is a text file that uses a format similar to that of .ini files. It is created automatically when you set the properties for a supported script file.
A .wsh file is created with the same name as the script file you right-clicked. A sample .wsh file might contain the following text:
[ScriptFile] Path=C:\WINNT\Samples\WSH\showprop.vbs [Options] Timeout=0 DisplayLogo=1 BatchMode=0
The Path setting in the [ScriptFile] section identifies the script file that this .wsh file is associated with. The keys in the [Options] section correspond to settings in the Script tab within the Properties dialog box.
When you double-click the .wsh file or execute 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.
It is important to note that you must have the original script file present when executing the .wsh file. If the .wsh file fails to execute the script, check the Path= entry in the .wsh file to ensure that it is pointing to the script you are attempting to run.