构建模块化 VBS 脚本的适当工具

发布于 2024-11-04 13:23:14 字数 346 浏览 1 评论 0原文

我有一个 vbscript,预期目的是连接到 Windows 服务器并执行各种子程序,以拉回有关服务器的各种信息。然而,我有不同的脚本用于不同的用途,尽管许多子脚本在它们之间是通用的。我不能只使用一个带有命令行参数的大型脚本来告诉要运行什么,因为我需要将这些不同的版本部署给不受信任的人,他们只需要查看特定的代码片段。

是否有一个工具可以使用,以便我可以单独编辑每个模块化子例程,然后根据某些定义将它们打包到包含必要部分的特定脚本中?

坦白说,我什至不知道从哪里开始寻找这样的东西,因为我是一个业余程序员,对构建工具之类的东西不太熟悉。如果有人甚至可以为我指出一个可以完成这项工作的工具的方向,我很乐意投入并进行所有研究。

谢谢。

I have a vbscript and the intended purpose is to connect to Windows servers and execute various subs that pull back various pieces of information about the server. However, I have different scripts for different uses, although many of the subs are common between them. I can't just have one large script with command line parameters telling what to run, since I need to deploy these various versions to untrusted people who only need to see particular pieces of the code.

Is there a tool I can use such that I can edit each of these modular subroutines individually and then based on some definition, package them into a particular script that includes the necessary pieces?

Frankly I'm not even sure where to begin searching for something like this since I'm very much an amateur programmer and very little familiarity with things like build tools. If anyone can even point me in the direction of a tool that might do the job, I'm very happy to dive in and do all the research.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不一样的天空 2024-11-11 13:23:14

不要带棒球棒去看篮球比赛。如果您正在执行敏感例程,则应该使用编译代码。 VBScript 不是适合这项工作的工具。

话虽这么说,您可以考虑加密您的脚本。

最后,如果您确实觉得应该采用包含路线,您可以在 ASP Free 上阅读我的文章。

在 VBScript 中使用 Includes

代码看起来有些东西像这样:

Import "include.vbs"

Sub Import(ByVal strFile)
   Set objFs = CreateObject("Scripting.FileSystemObject")
   Set WshShell = CreateObject("WScript.Shell")
   strFile = WshShell.ExpandEnvironmentStrings(strFile)
   file = objFs.GetAbsolutePathName(strFile)
   Set objFile = objFs.OpenTextFile(strFile)
   strCode = objFile.ReadAll
   objFile.Close
   ExecuteGlobal(strCode)
End Sub

Don't bring a baseball bat to a basketball game. If you are performing sensitive routines, you should be using compiled code. VBScript is not the right tool for the job.

That being said, you could consider encrypting your scripts.

Finally, if you really feel you should go the include route, you can read my article over at ASP Free.

Using Includes in VBScript

The code looks something like this:

Import "include.vbs"

Sub Import(ByVal strFile)
   Set objFs = CreateObject("Scripting.FileSystemObject")
   Set WshShell = CreateObject("WScript.Shell")
   strFile = WshShell.ExpandEnvironmentStrings(strFile)
   file = objFs.GetAbsolutePathName(strFile)
   Set objFile = objFs.OpenTextFile(strFile)
   strCode = objFile.ReadAll
   objFile.Close
   ExecuteGlobal(strCode)
End Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文