我想做的是从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:windowssystem32PresentationSettings.exe
,我找不到文件,但是当我从"正常"命令提示符尝试时,它可以工作。
有人知道一个提示/技巧/技巧来完成我想要做的事情吗?
<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>