0

我在 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
4

2 回答 2

1

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

从 Windows 路径转换为 ​​unix。

cygpath "D:\\tmp"

请注意,我使用双反斜杠是因为它需要转义,因为它具有特殊含义。

从 unix 转换为 Windows

cygpath -w "/usr/bin"
于 2013-07-07T19:04:05.903 回答
0

Bash: cygpath -m '/cygwin/c/Users 会返回 c:/Users . -m代表“混合”,表示正斜杠与卷标识符一起使用。

如果你在没有 shell 的情况下启动它,你应该去掉单引号。

我不记得在 Perl 中使用单引号是否有同样的区别,你自己试试。

于 2017-02-16T14:11:08.913 回答