LoginSignup
8
9

More than 5 years have passed since last update.

Bash on Ubuntu on Windowsからcmd / startを使う

Posted at

はじめに

Bash on Ubuntu on WindowsはWindowsのファイルにアクセスしたりその逆もできます。
ですが、別システムのようなものなのでBashからWindowsのexeファイルを実行したり、
拡張子を関連付けたプログラムでファイルを開いたりできません。

これをどうにかできるようにしたcbwinがあったので導入してみました。

cbwinをインストール

  1. Bash on Ubuntu on Windows側でcbwin/releasesからzipをダウンロードして展開します。
  2. 展開したらinstall.shを実行します。
  3. 同梱されているoutbash.exeをWindows側の任意のパスにコピーします。
$ curl -LO https://github.com/xilun/cbwin/releases/download/v0.9/cbwin-bin-0.9.zip
$ unzip cbwin-bin-0.9.zip
$ cd cbwin-bin-0.9
$ sudo ./install.sh
$ mkdir /mnt/c/bin
$ cp outbash.exe /mnt/c/bin

以上で、/usr/local/binwcmd, wstart, wrunがインストールされます。
それぞれcmd, startの代わりと直接CreateProcessを実行するコマンドです。

cbwinを実行

Bash on Ubuntu on Windowsのbashを実行する代わりにoutbash.exeを実行します。
すると見た目は変わりませんが、インストールした3つのコマンドを使うことができます。

8
9
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
8
9