Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cygwin、cygstart、unix路径到windows 8字符路径_Unix_Window_Cygwin - Fatal编程技术网

cygwin、cygstart、unix路径到windows 8字符路径

cygwin、cygstart、unix路径到windows 8字符路径,unix,window,cygwin,Unix,Window,Cygwin,我在cygwin下使用perl运行imagemagick和LaTeX。出于各种原因,我必须在cygstart下运行pdflatex。我在cygstart命令中有一个带空格的路径,只有在没有空格的windows路径下才能正确运行它 cygstart c:/stuff/pdflatex.exe c:/Users/mainho~1/Pictures/6-13/directory.tex mainho~1" is the 8char form of "main home computer 我想要一个

我在cygwin下使用perl运行imagemagick和LaTeX。出于各种原因,我必须在cygstart下运行pdflatex。我在cygstart命令中有一个带空格的路径,只有在没有空格的windows路径下才能正确运行它

cygstart c:/stuff/pdflatex.exe c:/Users/mainho~1/Pictures/6-13/directory.tex

mainho~1" is the 8char form of "main home computer
我想要一个perl或unix函数,它需要

/cygdrive/c/Users/main\ home\ computer/Pictures/6-13/directory.tex
他会回来的

c:/Users/mainho~1/Pictures/6-13/directory.tex

您可以在shell中使用
cygpath
命令在两种路径格式之间进行转换

从Windows路径转换到unix

cygpath "D:\\tmp"
注意,我使用了双反斜杠,因为它需要转义,因为它有特殊的含义

从unix转换到Windows

cygpath -w "/usr/bin"
狂欢节:
cygpath-m'/cygwin/c/Users
会回来吗
c:/Users
.
-m
代表“mixed”,意思是前斜杠与卷标识符一起使用

如果您在没有shell的情况下启动它,那么应该删除单引号


我不记得在Perl中使用单引号是否会产生同样的效果,请自己试试。

实际上,这些都是反向的。
-w
开关将从unix转换到windows,因此您的两个示例不起任何作用。它们应该是
cygpath-w”/usr/bin“
cygpath“D:\\tmp”
前面的斜杠不是
cygpath
本身所必需的,而是shell所必需的。可以在bash中使用单引号来删除一条斜杠。