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

查看:22
本文介绍了如何在 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 Script Host"框架(如果你想这样称呼它)提供了一个 XML 包装文档,它在常规 vbs 文件上添加了功能.其中之一是能够包含 VBscript 和 Jscript 风格的外部脚本文件.我从来没有深入了解它,但我认为它会做你想做的事.http://msdn.microsoft.com/en-us/库/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天全站免登陆