Cygwin convert windows path to linux path: Difference between revisions
m Text replacement - "== reference ==" to "== References ==" |
|||
| (4 intermediate revisions by one other user not shown) | |||
| Line 9: | Line 9: | ||
local directory e.g. {{kbd | key=<nowiki>c:\Program Files\</nowiki>}} | local directory e.g. {{kbd | key=<nowiki>c:\Program Files\</nowiki>}} | ||
<pre> | <pre> | ||
enclose the whole path with single quote symbol | |||
$ cygpath -u 'c:\Users\User\Desktop\' | $ cygpath -u 'c:\Users\User\Desktop\' | ||
/cygdrive/c/Users/User/Desktop/ | /cygdrive/c/Users/User/Desktop/ | ||
$ cygpath -u 'c:\Program Files\' | $ cygpath -u 'c:\Program Files\' | ||
/cygdrive/c/Program Files/ | /cygdrive/c/Program Files/ | ||
| Line 20: | Line 20: | ||
<pre> | <pre> | ||
enclose the whole path with single quote symbol | enclose the whole path with single quote symbol | ||
//method1 | |||
$ cygpath -u '\\remote\test path\' | |||
//remote/test path/ | |||
//method2: replace backward slash with forward slash | |||
$ path = '\\remote\path\' | $ path = '\\remote\path\' | ||
$ echo "${path//\\//}" | $ echo "${path//\\//}" | ||
| Line 62: | Line 67: | ||
== convert linux path to windows path == | == convert linux path to windows path == | ||
local directory | |||
<pre> | <pre> | ||
$ cygpath -w '/cygdrive/c/Program Files/' | $ cygpath -w '/cygdrive/c/Program Files/' | ||
| Line 67: | Line 73: | ||
</pre> | </pre> | ||
remote directory (network drive) | |||
<pre> | |||
$ cygpath -w '//remote/test path/' | |||
\\remote\test path\ | |||
</pre> | |||
== | == References == | ||
* [http://cygwin-lite.sourceforge.net/html/cygpath.html Cygwin Utilities: cygpath] | * [http://cygwin-lite.sourceforge.net/html/cygpath.html Cygwin Utilities: cygpath] | ||
* [http://superuser.com/questions/885700/cygwin-convert-windows-path-to-unix-then-change-dir/1068015#1068015 Cygwin convert windows path to unix then change dir - Super User] | * [http://superuser.com/questions/885700/cygwin-convert-windows-path-to-unix-then-change-dir/1068015#1068015 Cygwin convert windows path to unix then change dir - Super User] | ||