7
10

More than 1 year has passed since last update.

windows10のIE11からローカルのexeを実行 (URIスキーマ,ActiveX)

Last updated at Posted at 2017-05-21

レジストリにURIスキーマを新規登録する方法

Edgeでは実行できなかった。IEでは実行できた。

note.reg
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\note]
"URL Protocol"=""

[HKEY_CLASSES_ROOT\note\shell]

[HKEY_CLASSES_ROOT\note\shell\Open]

[HKEY_CLASSES_ROOT\note\shell\Open\command]
@="\"C:\\Windows\\notepad.exe\""

reg0.png
reg1.png

<a href="note:">notepad</a>

open.png
open2.png

ActiveX 例1

<script LANGUAGE="JavaScript">
function cmd() {
    var obj = new ActiveXObject("WScript.Shell");
    obj.Run("cmd.exe");
}
</script>
<body>
<a href="javascript:cmd()">コマンドプロンプト</a><br>
</body>

ActiveX 例2

function _notepad(filename) {
    var shell = new ActiveXObject("WScript.Shell");
    shell.Run("C:\\windows\notepad.exe" + filename);
}

ローカルにhttpサーバーを建ててそこからexe実行

  • http://localhost:8000/ にアクセスしたら c:\windows\notepad.exeを実行するようなの作るとか。
7
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
10