fall
fall

Reputation: 1182

Copy windows path into linux based terminals: Conemu, Cygwin, Git Bash

When I copy a windows path from windows explorer's location bar, C:\Users\Administrator\Links, it gets automatically translated to one of the following:

Cygwin in Conemu: /mnt/c/Users/Administrator/Links

Git bash in Conemu: /mnt/c/Users/Administrator/Links

Cygwin64 Terminal: (no translation) C:\Users\Administrator\Links

Git Bash on Windows: (no translation) C:\Users\Administrator\Links

But Cygwin actually wants C:/Users/Administrator/nextcloud/diary or /cygdrive/c/Users/Administrator/nextcloud/diary

and Git Bash actually wants /c/Users/Administrator/Links

So each time I try to cd into that directory, I get bash: cd: /mnt/c/Users/Administrator/Links: No such file or directory. Then I have to manually change the path.

Is there a way to change Conemu's "translation" rule? Do you experience the same problems when using linux terminals with/without Conemu? How did you cope with this?

Edit:

The Git Bash is started in Conemu by setting up a task with commands: C:\Program Files\Git\git-cmd.exe --no-cd --command=usr/bin/bash.exe -l -i -new_console:t:"Git Bash" and Cygwin is started in Conemu with commands D:\app\cygwin64\Cygwin.bat -new_console:t:"cygwin"

Upvotes: 0

Views: 936

Answers (2)

fall
fall

Reputation: 1182

Based on @cisco.prog 's answer

In Startup > Tasks

I added -cur_console:m:"/cygdrive" for Cygwin and -cur_console:m:" for Git Bash.

Then I restarted Conemu to make changes take effect.

Now when I paste windows path into Cygwin tab, it is automatically converted to /cygdrive/c/path/to/file. When I paste windows path into Git Bash tab, it is automatically converted to /c/path/to/file.

Upvotes: 0

cisco.prog
cisco.prog

Reputation: 49

I ran into the same problem using Cmder (which uses Conemu). In the launch options (in Cmder, it's in Startup - Tasks), you must select the task (for example bash :: bash) and add:

-cur_console: m: "".

Indeed, according to the documentation:

https://conemu.github.io/en/NewConsole.html#syntax

in the options of -cur_console, we can read:

m: / mnt - defines ‘/ mnt’ prefix for Unix-path conversion, m: "" - no prefix

Upvotes: 3

Related Questions