- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
无论我做什么,我都无法让它工作。即使我在 BAT 文件中删除“msg/server:”语法并从 Shell.Run 中调用它,它仍然说“'msg' 未被识别为内部或外部命令、可运行程序或批处理文件。”
我也试过“msg.exe”和“c:\windows\system32\msg.exe”。所有表单在 CMD 控制台直接输入、VBScript 或 CMD/BAT 脚本中都能正常工作,但在 HTA 中却不行。这是“设计”的安全功能吗?有什么办法吗?
最佳答案
为了向后兼容,64 位 Windows 附带两个版本的 MSHTA.exe:
C:\Windows\SysWOW64\mshta.exe and
C:\Windows\System32\mshta.exe
您描述的行为是对 64 位 MSHTA.exe 的好奇之一,它无法调用 MSG.exe 等 32 位应用程序。请注意,位于 c:\windows\SysWOW64\cmd.exe 的 64 位命令提示符也将无法找到 MSG.exe。
要修复此问题,您可以将 .hta 文件与 32 位 MSHTA.exe 相关联,或者创建一个简单的批处理文件来启动您的 HTA,START_MSG.cmd:
START C:\Windows\System32\mshta.exe C:\YOUR_PATH\MSG.hta
我已经使用 64 位和 32 位版本的 MSHTA.exe 测试了下面的 HTA。 64 位版本引发“找不到文件”错误,但 32 位版本有效。
<script language="Javascript">
var E, LineWriteTimerID
function execWithStatus(cmdLine){
E = new ActiveXObject("WScript.Shell").Exec(cmdLine);
LineWriteTimerID = window.setInterval("writeOutLine()",100);
E.StdIn.Close();
}
function writeOutLine(){
if(E.StdOut.AtEndOfStream) window.clearTimeout(LineWriteTimerID);
if(!E.StdErr.AtEndOfStream) txtResults.value += "ERROR: " + E.StdErr.ReadAll() + "\n";
if(!E.StdOut.AtEndOfStream) txtResults.value += E.StdOut.ReadLine() + "\n";
}
</script>
<textarea id=txtCmd style="width:90%" rows=1>MSG.exe</textarea>
<button onclick="execWithStatus(txtCmd.value)">Run</button>
<br><textarea id=txtResults style="width:100%" rows=20></textarea>
关于shell - 通过 Wscript.Shell Run 从 HTA 调用 MSG.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9833604/
我正在使用 Waf 构建一个项目。它有几个第三方依赖项,我想从我的主要 wscript 构建每个依赖项。我的项目是这样组织的: /boost/ /gtest/ /source/ /waf /wscri
我在 Javascript 中使用 ActiveXObject。 var shell = new ActiveXObject("WScript.Shell"); exec = shell.exec('
我正在使用Excel将一些文件上传到带有WinSCP的服务器上。此示例起作用:。现在,我希望Excel等到外壳关闭。。使用来自等待外壳命令完成的信息,我将其组合成以下代码:。不幸的是,这并不管用。Ex
特殊文件夹名称用于索引该集合以检索所需的特殊文件夹,文档中列出了下面的特殊文件夹: AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUs
我不了解VBScript,但是最近我需要编写一个具有SendKeys功能的脚本,而我无法在批处理文件中做到这一点。当我使用命令cscript test.vbs在Windows 7计算机中从命令提示符运
最近我在一个test.bat中看到这样的代码: @if (@This==@IsBatch) @then @echo off rem This is batch wscript //E:JScript
我正在尝试在本地运行一个 Javascript 文件,它应该使用 ImageMagick 创建一个 CSS 图像 Sprite 。它是 OpenID 选择器 JS 组件的一部分:http://code
我想使用 Windows 脚本宿主(wscript.exe 或 cscript.exe)执行由我的应用程序生成的简单 VBScript/JScript,而不生成临时脚本文件。 我没有找到从标准输入流读
1、wscript对象 描述:提供对 Windows 脚本宿主对象模型根对象的访问。 详述:WScript 对象是 Windows 脚本宿主对象模型层次结构的根对象。它可在任何脚本文件中使用,不
在windows2000下,IIS默认设置是可以web和可执行程序通信的。但是在2003下IIS关于这方面的服务是禁止的。 我现在遇到的问题是,利用web和一个带参数的可执行程序连接。并运行这个带
我试图检查注册表项是否存在,无论我尝试什么,我总是收到错误消息“无法打开注册表项进行读取” 我使用的代码: keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\BOS\\
我正在尝试编写一个VBScript,它将以文本文件或csv的形式列出系统上所有已安装的应用程序。我能够找到一个列出所有软件的现有代码(包括名称,版本,日期和大小)。当我当前运行它时,我发现它随着主机回
我正在使用 WScript通过使用 WScript.Shell 调用外部程序来自动化一些任务。 但是,现在它不会等待外部程序完成,而是继续前进。这会导致问题,因为我有一些任务依赖于其他人先完成。 我使
所以我试图通过嵌入在powershell脚本中的cscript.exe运行VBscript。它会因允许错误而不断出错。在调试代码时,我意识到确切的命令不会在cscript或wscript中运行,而是从
嗨,我刚刚发现了 Wscript,我尝试运行一个在浏览器上运行的脚本,但出现了上述错误,我明白问题是什么,但我想问是否有一种方法可以定义文档对象(html 文件和 cookies)可能来自命令提示符,
目前,WScript 在出现脚本错误时会弹出消息框。这些脚本由其他进程调用,并在服务器上运行,因此没有人可以忽略错误框。 我想要的是将错误消息转储到 STDOUT,并执行以返回调用进程。作为 MSGB
我正在运行 Word 2013 中的 VBA 宏。我正在尝试运行需要文件名参数/参数的可执行文件。例如,c:\myfilefilter.exe filetobefiltered.htm 我想使用She
我希望使用 Javascript 执行以下操作,这是我的完整 JS 文件 (test.js): var xo = WScript.CreateObject("Msxml2.XMLHTTP"); var
如果我在 IE9 (win7) 中尝试它,那么它工作得很好,但是当我尝试在 IE8、7、6 (winXP) 中运行这段代码时,调试器写道,它无法创建对象。 var wscript = new Acti
我正在使用此代码:通过单击浏览器中的按钮来创建新文件夹, function exer() { var wsr = WScript.CreateObject("WScript.Shell");
我是一名优秀的程序员,十分优秀!