Windows Script Host

Windows Script Host(简称WSH),是Windows操作系统脚本语言程序(script)的运行环境。

Windows Script Host (WSH)
其他名称Windows Scripting Host
开发者Microsoft
操作系统Microsoft Windows
类型自动化技术
许可协议专有商业软件
网站Windows Script Host overview

Windows Script Host最早出现在Windows 98,经过不断发展与强化,尔后的Windows操作系统(包括用户端伺服端版本)都内置了WSH。用户通过Windows Script Host能自行编写一些程序,用以简化日常工作流程,或制作一些实用的系统管理程序。

版本

Windows版本 相应的WSH版本 最新可再发行组件的版本
Windows 95 没有(独立的可再发行组件) 5.6
Windows NT 4.0 没有(独立的可再发行组件) 5.6
Windows 98 1.0 5.6
Windows 2000 2.0(也被称为WSH 5.1) 5.7
Windows Me 2.0(也被称为WSH 5.1) 5.6
Windows XP / Windows Server 2003 5.6 5.7
Windows Vista / Windows Server 2008 / Windows XP SP3 5.7
Windows 7 / Windows Server 2008 R2 / Windows 8 / Windows Server 2012 5.8
Windows 11 / Windows 10 / Windows Server 2016 5.812

查看WSH的版本

进入DOS环境(或「命令提示字符」),在「命令提示符号」旁输入cscript(如:C:\cscript),按「Enter」出现以下消息:[1]

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
用法:CScript scriptname.extension [选项...] [参数...]
选项:
 //B         批量模式:不显示Script错误和提示
 //D         激活主动式调试
 //E:engine  使用该引擎来运行Script
 //H:CScript 改变缺省的Script Host为CScript.exe
 //H:WScript 改变缺省的Script Host为WScript.exe (默认值)
 //I         交互式模式 (默认值,与 //B恰相反)
 //Job:xxxx  运行一个WSF工作
 //Logo      显示标志 (默认值)
 //Nologo    不显示标志:在运行阶段不会出现标志
 //S         为用户保存目前的命令行
 //T:nn      逾时值(单位为秒): 容许Script运行的最大时限
 //X         在调试工具中运行Script
 //U         利用Unicode从主控台上重新引导I/O

支持解释器

Hello, world!

JScript为例:

 WScript.Echo("Hello, world!");    //注意!JavaScript在浏览器中用document.write()。

参考数据

  1. 如果没有出现,就表示你的系统并没有WSH的环境。

内部链接

外部链接

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.