如何在VBScript中包含公共文件(类似于C #include)? [英] How do I include a common file in VBScript (similar to C #include)?

查看:157
本文介绍了如何在VBScript中包含公共文件(类似于C #include)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VBScript似乎无法包含常用的函数文件。

VBScript doesn't appear to have a way to include a common file of functions.

有没有办法实现这个目标?

Is there a way to achieve this?

推荐答案

Windows脚本宿主框架(如果你想称之为),提供了一个XML包装器文档,它增加了常规vbs文件的功能。其中之一是能够包含VBscript和Jscript风格的外部脚本文件。我从来没有深入到它,但我认为它会做你想做的事情。
http://msdn.microsoft.com/ en-us / library / 15x4407c(VS.85).aspx

The "Windows Script Host" framework (if ya want to call it that), offers an XML wrapper document that adds functionality over regular vbs files. One of which is the ability to include external script files of both the VBscript and Jscript flavors. I never got very deep into it, but I think it would do what you're wanting to do. http://msdn.microsoft.com/en-us/library/15x4407c(VS.85).aspx

您可以包含JavaScript,VBScript或其他WScript脚本语言的模块。

You can include JavaScript, VBScript, or modules of other WScript script languages.

示例WSF文件:

<job id="IncludeExample">
   <script language="JavaScript" src="sprintf.js"/>
   <script language="VBScript" src="logging.vbs"/>
   <script language="VBScript" src="iis-queryScriptMaps.vbs"/>
</job>

如果上述文件名为iis-scriptmaps.wsf,请使用cscript以这种方式运行。 exe:

If the above file is called "iis-scriptmaps.wsf", run it this way with cscript.exe:

cscript.exe  iis-scriptmaps.wsf

这篇关于如何在VBScript中包含公共文件(类似于C #include)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆