LoginSignup
2
4

More than 5 years have passed since last update.

IEから指定したエクスプローラを開く方法

Last updated at Posted at 2018-03-29
<html>
<script type="text/javascript">

var path = "C:¥test¥test1";
path.replace(/\u002f/g,'\\');

$('a').on('click', function (e){
  var openForlder = 'explorer.exe /n,/e,/root,' + path;
  var ActiveXobj = new ActiveXObject("WScript.Shell");
  ActiveXobj.Run(openForlder);
}

</script>
<a id="open_explorer" style="cursor:pointer;">Open</a>
</html> 

ただし、 ActiveXObject を使用するには、Internet Explorer で関連するセキュリティ ゾーンのセキュリティ設定を調整することが必要になります。

たとえば、[ローカル イントラネット] ゾーンでは、通常、[スクリプトを実行しても安全だとマークされていない ActiveX コントロールの初期化とスクリプトの実行] を有効にするようにカスタム設定を変更する必要があります。

参照:
https://msdn.microsoft.com/ja-jp/library/7sw4ddf8(v=vs.94).aspx

2
4
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
2
4