LoginSignup
4
3

More than 5 years have passed since last update.

CygwinでWindowsのフォルダにさくっと移動する方法

Posted at

(1)Cygwinで次のコマンドを打ちます

 alias clipcd='cd "$(cat /dev/clipboard | cygpath -u -f -)"'

(2) Windowsでパスを右クリックでコピーします。

(3)Cygwinでclipcdと打つと、コピーしたパスに移動します。

永続化

Cygwinを立ち上げるたびにエイリアスを張るのは面倒なので永続化しましょう。
bashが起動するとき実行される.bashrcファイルに(1)のコマンドを追記します。

cd ~
vi .bashrc

ついでに次の関数も.bashrcに書いておくと、wincd "ウィンドウズのパス"で移動できて便利です。

function wincd(){
  cd `cygpath -u $1`
}

※Babunを使っている場合は、zsh環境なので.bashrcでなく.zshrcに書いて下さい。

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