【问题标题】:VBScript to open Windows 8 / 8.1 RecoveryDrive.exeVBScript 打开 Windows 8 / 8.1 RecoveryDrive.exe
【发布时间】:2014-03-27 08:01:02
【问题描述】:

我正在尝试使用将打开 Windows 8 RecoveryDrive 程序的 vbscript 创建一个 .hta 应用程序。我的脚本如下:

Sub Windows8Recovery
'// Open the Windows 8 / 8.1 default recovery program
Set oShell = CreateObject("Wscript.Shell")
oShell.Run "c:\windows\system32\recoverydrive.exe"
End Sub

每次运行时我都会收到一条错误消息:“系统找不到指定的文件。”

求救!!!

【问题讨论】:

  • 在命令提示符下测试了文件路径,它按预期工作。将脚本作为单独的 .vbs 文件进行了测试,它按预期工作。从 .hta 文件运行这种类型的命令有什么特别之处吗?

标签: windows-8 vbscript windows-8.1 hta


【解决方案1】:

终于找到问题了。我在 64 位操作系统上运行它。与 Windows 文件系统重定向器以及它如何处理 32 位和 64 位应用程序有关:http://msdn.microsoft.com/en-us/library/aa384187(VS.85)。能够使用 PowerShell 找到解决方法。这是工作代码:

<html>
    <body>
        <a href='#' onclick='Windows8Recovery()'>Win 8 Default Recovery</a>
        <script language="VBScript">
            Sub Windows8Recovery
                Set objShell = CreateObject("Wscript.Shell")
                strRDPath = objShell.ExpandEnvironmentStrings( "%SystemRoot%" ) & "\sysnative\RecoveryDrive.exe"
                Set objShellExec = CreateObject("Shell.Application")
                objShellExec.ShellExecute "powershell.exe", strRDPath, "", "runas", 1               
            End Sub
        </script>
    </body>
</html>

【讨论】:

    猜你喜欢
    • 2015-05-18
    • 1970-01-01
    • 1970-01-01
    • 2014-11-11
    • 2015-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多