运行 vbscript mhta [英] run vbscript mhta
问题描述
我想从 mhta 运行 vbscript
i want to run vbscript from mhta
推荐答案
mshta "vbscript:window.close(msgbox("test"))"
WScript
或 CScript
脚本宿主无法运行未存储在文件中的脚本.但是您可以使用 mshta
和 vbscript:
协议来运行简单的命令.
WScript
or CScript
script hosts are not able to run a script if it is not stored in a file. But you can use mshta
and the vbscript:
protocol to run simple commands.
无论如何,对于这种情况,使用起来更容易
Anyway, for this case, it is easier to use
msg console "test"
编辑以适应评论
我正在测试.mshta url 中的 vbscript 解析器必须面临很多限制.还有空格问题,命令与 :
的串联问题,将过程作为函数调用的问题,但您不能使用 call
关键字,因为需要空格,....
i've being testing. vbscript parser in the mshta url has to face a lot of limitations. And problems with spaces, concatenation of commands with :
, problems with procedure calling as a function but you can not use call
keyword as a space is required, ....
唯一稳定、简单"的方法是准备 vbscript 作为字符串执行,其中没有空格,然后使用 execute 方法运行它
The only stable, "easy" way of doing it is to prepare the vbscript to execute as a string, with no spaces inside it, and use the execute method to run it
mshta "vbscript:window.close(execute("msgbox"&chr(32)&"""test"":msgbox"&chr(32)&"""this"&chr(32)&"should"&chr(32)&"work"""))"
mshta "vbscript:window.close(execute("server=CreateObject(""WScript.Shell"").RegRead(""HKEY_CURRENT_USER\Volatile"&chr(32)&"Environment\LOGONSERVER""):For"&chr(32)&"i=1"&chr(32)&"to"&chr(32)&"3:msgbox"&chr(32)&"i"&chr(38)&"server:next"))"
这篇关于运行 vbscript mhta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!