DEV Community

KOGA Mitsuhiro
KOGA Mitsuhiro

Posted on • Originally published at qiita.com

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

はじめに

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つのコマンドを使うことができます。

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay