There are two versions of WSH: a Windows-based version (Wscript.exe) that provides Windows-based properties for setting script properties, and a command prompt-based version (Cscript.exe) that provides command-line switches for setting script properties. You can run either of these versions by typing "wscript.exe" or "cscript.exe" at a command prompt.
To Run Scripts Using the Windows-Based Script Host (Wscript.exe)
- At a command prompt type
wscript.exe, and then press ENTER.
- Set the script host properties you want, and then click OK.
- In Windows Explorer or My Computer, double-click the script file you want to run.
You can also set properties for an individual script by right-clicking a script file in My Computer or Windows Explorer, clicking Properties, and then clicking the Script tab.
To Set Properties for Individual Scripts
- In Windows Explorer or My Computer, right-click the script file for which you want to specify individual properties, and then click Properties.
- Click the Script tab, set the options you want to use for the script, and then click OK.
A .wsh file is a text file that uses a format similar to that of .ini files. A .wsh file contains a [ScriptFile] section, which identifies the script file with which the .wsh file is associated, and an [Options] section, which corresponds to the settings you selected on the Script tab.
A .wsh file is analogous to the .pif files used to run earlier 16-bit Windows-based and MS-DOS-based programs. It can be treated as if it were an executable or batch file. For example, if you have a script named Myscript.vbs for which you have created a .wsh file named Myscript.wsh, you can run Myscript.vbs with the options recorded in Myscript.wsh by double-clicking Myscript.wsh in Windows Explorer, or by passing Myscript.wsh as a script argument to Cscript.exe or Wscript.exe at a command prompt.
For additional information about WSH, please visit the following Microsoft Web site:
รหัสบทความ: 232211 - การตรวจสอบครั้งสุดท้าย: 16 ธ.ค. 2009 - ฉบับแก้ไข: 1