从HTA

时间:2017-06-15 04:18:48

标签: activex jscript hta

我要做的是从HTA调用PresentationSettings /start。它在正常的命令提示符下工作正常,但是当我从HTA尝试时,没有骰子。我假设存在权限问题,因此我确保以管理员身份运行HTA,然后以管理员身份运行命令,如下所示:

var shellApp = new ActiveXObject('Shell.Application');

// Just open the GUI and keep command prompt open for testing
shellApp.ShellExecute("cmd", "/k PresentationSettings", "", "open", 1);

不幸的是,我收到了消息:

'PresentationSettings' is not recognized as an internal or external command, operable program or batch file.

如果我尝试dir c:\windows\system32\PresentationSettings.exe,我找不到文件,但是当我从“正常”命令提示符尝试时,它可以正常工作。

任何人都知道要完成我正在做的事情的提示/技巧/黑客?

1 个答案:

答案 0 :(得分:0)

<html>
<head>
</head>
<body>
<script>
function OpenFile(file) {
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var f = fso.GetFile(file);
    var file_ok = f.ShortPath.toUpperCase();

    var ws = new ActiveXObject("WScript.Shell");
    ws.Run("" + file_ok + "");
}

OpenFile ('c://windows//system32//PresentationSettings.exe');

window.close();

</script>
</body>
</html>