0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

startコマンドの代わりにexplorer.exeを使うといいよ!

Last updated at Posted at 2022-10-03

結論

Windows上でURLを指定して規定のブラウザで開くときには、昔の方法では

start https://www.yahoo.co.jp/

と書いていましたが、

 explorer.exe https://www.yahoo.co.jp/

と書くのが今風です。

理由

startコマンドはWSLからは呼び出せませんが、explorer.exeはWSLからも呼び出せます(当然PowerShellからも呼べますのでstartコマンドのことは忘れてもいいくらいです)。

背景

WSL2にはUbuntu上のGUIで動くChromeもインストールは可能ではあるので、Linux上に入れたChromeを「google-chrome https://www.yahoo.co.jp/ 」で開くことも可能ですが、さすがにフォントがガビガビしていて、WSL2上のchromeを使うという人はいないでしょう。

そうなると、「WSL2からWindows上のGUIアプリを呼び出す」必要があり、explorer.exe経由でWindows側でのデフォルトブラウザを開いています。

応用編

WSL上(正確にはWSLに接続したWindowsターミナル」から以下のコマンドを開くことで、今いるフォルダをWindows側のフォルダとして開くこともできます。

explorer.exe .

Ubuntu上で作ったファイルをSlackにえい!とドラッグ&ドロップで添付したいときなどは、上記のコマンドはよく使いますね。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?