Using .WSH Files to Run Scripts

A .wsh file is analagous to the .pif files used to run older 16-bit applications. The .wsh file can be treated as if it were an executable or batch file.

For example, suppose you have a script named Myscript.vbs for which you have created a .wsh file named Myscript.wsh. To run Myscript.vbs with the options recorded in Myscript.wsh, you can double-click Myscript.wsh in Windows Explorer. You can also pass Myscript.wsh as a script argument to CScript.exe or WScript.exe by typing the following in the Command Prompt window:

cscript Myscript.wsh

Administrators in particular will find .wsh files useful. By creating multiple different .wsh files for a given script, an administrator can tailor the way that script runs to the needs of specific groups or even individuals within an organization.

The same logon script, for example, might serve two very different groups if invoked by two different .wsh files containing different settings and parameters.