从HTA调用PresentationSettings

问题描述 投票:0回答:1

我想做的是从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,则找不到文件,但是当我从“正常”命令提示符下尝试时,它可以工作。

任何人都知道完成我要完成的工作的技巧/窍门/技巧?

activex jscript hta
1个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.