Windows 8 打开Windows 8/8.1 RecoveryDrive.exe的VBScript
我正在尝试使用vbscript创建一个.hta应用程序,该应用程序将打开Windows 8 RecoveryDrive程序。我的剧本如下:Windows 8 打开Windows 8/8.1 RecoveryDrive.exe的VBScript,windows-8,vbscript,windows-8.1,hta,Windows 8,Vbscript,Windows 8.1,Hta,我正在尝试使用vbscript创建一个.hta应用程序,该应用程序将打开Windows 8 RecoveryDrive程序。我的剧本如下: 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 每次
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
每次运行此命令时,我都会收到一条错误消息:“系统找不到指定的文件。”
救命啊 终于找到了问题。我在64位操作系统上运行这个。与windows文件系统重定向程序及其处理32位与64位应用程序的方式有关:。能够找到一个使用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>
子窗口恢复
设置objShell=CreateObject(“Wscript.Shell”)
strRDPath=objShell.ExpandEnvironmentStrings(“%SystemRoot%”)&“\sysnative\RecoveryDrive.exe”
设置objShellExec=CreateObject(“Shell.Application”)
objShellExec.ShellExecute“powershell.exe”,strRDPath,,“runas”,1
端接头
在命令提示符下测试了文件路径,其工作正常。将脚本作为一个单独的.vbs文件进行测试,结果与预期一致。从.hta文件运行这种类型的命令有什么特别之处吗?