在 Windows 批处理文件中嵌入 VBScript

发布于 2024-09-29 05:38:43 字数 319 浏览 0 评论 0原文

是否可以在批处理文件中嵌入 VBScript?

我目前有一个 .CMD 文件,它使用 .VBS 文件进行调用

cscript //NoLogo MyScript.vbs

,但我更愿意只分发一个 .CMD 文件。


编辑:有一个类似的问题,其中包含如何在不生成中间文件的情况下执行此操作的答案:是否可能在批处理文件中嵌入并执行 VBScript 而不使用临时文件?

Is it possible to embed VBScript within a batch file?

I currently have a .CMD file that calls a .VBS file using

cscript //NoLogo MyScript.vbs

but I'd prefer to distribute just a single .CMD file.


EDIT: There is a similar question with answers on how to do this without generating an intermediate file at all: Is it possible to embed and execute VBScript within a batch file without using a temporary file?

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

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

发布评论

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

评论(1

叶落知秋 2024-10-06 05:38:43

http://www.computerhope.com/forum/index.php?topic=103686.0

@echo off
echo This is batch
:wscript.echo "This VBScript"
:wscript.echo "Today is " & day(date) & "-" & month(date) & "-" & year(date)
findstr "^:" "%~sf0">temp.vbs & cscript //nologo temp.vbs & del temp.vbs
echo This is batch again

http://www.computerhope.com/forum/index.php?topic=103686.0

@echo off
echo This is batch
:wscript.echo "This VBScript"
:wscript.echo "Today is " & day(date) & "-" & month(date) & "-" & year(date)
findstr "^:" "%~sf0">temp.vbs & cscript //nologo temp.vbs & del temp.vbs
echo This is batch again
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文