6
4

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 3 years have passed since last update.

wslからgoogle-chromeでchromeを起動したい

Last updated at Posted at 2022-01-04

wsl上のUbuntuからWindows上のChromeを起動したいケースってあるよね。

ガチLinuxのUbuntuではchromeにはgoogle-chromeという起動スクリプトが作られる。chromeの起動くらいは、ガチUbuntuとwsl Ubuntuと同じソースで動かしたい。

ということでWSL上にもWindows側のChromeを起動するスクリプトを作ってあげれば同じように起動できる。

$ /usr/local/bin# cat google-chrome
# !/bin/bash
exec "/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" "$@"

パスの通ったところ(ここでは/usr/local/bin)に、シェルスクリプトを作る。

$@を使ってシェルスクリプトに渡された引数はすべて本体のchromeに渡してる。

あとは、ファイルに実行権限をつけてあげればOK。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?