Cygwin路径到/ cygdrive / C /程序文件(x86)/ GnuWin32目录? [英] Cygwin path to /cygdrive/C/Program Files (x86)/GnuWin32 directory?

查看:869
本文介绍了Cygwin路径到/ cygdrive / C /程序文件(x86)/ GnuWin32目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Cygwin中执行位于Windows中C:\Program Files(x86)目录下的程序时遇到问题,有人知道让这个工作吗?

  jboss @ QA024 /cygdrive/C/jboss/EAP-6.0.1/jboss-eap-6.0/bin 
$ wgetexe =/ cygdrive / C /程序文件(x86)/GnuWin32/wget.exe --help

jboss @ QA024 /cygdrive/C/jboss/EAP-6.0.1/jboss-eap-6.0/bin
$ bash $ wgetexe
bash:/ cygdrive / C / Program:没有这样的文件或目录

jboss @ QA024 /cygdrive/C/jboss/EAP-6.0.1/jboss-eap- 6.0 / bin
$ bash$ wgetexe
bash:/ cygdrive / C / Program Files(x86)/GnuWin32/wget.exe --help:没有这样的文件或目录


解决方案

尝试:

  wgetexe =/ cygdrive / C / Program Files(x86)/GnuWin32/wget.exe
$ wgetexe--help

由于它是一个可执行文件,因此不希望将其作为参数传递给bash,这将尝试作为脚本执行。它在路径名中有空格,您需要引用该名称,以便shell不尝试使用无效参数执行 cygdrive / C / Program



您还应该能够将目录添加到 $ PATH

  PATH =$ PATH:/ cygdrive / C / Program Files(x86)/ GnuWin32

请记住,GnuWin32程序是Windows可执行文件,它们使用的任何文件路径将使用Windows语法解释。 Cywin可执行文件(任何使用 cygwin1.dll )使用Cygwin路径语法。



更好的是,安装Cygwin版本 wget ,只需调用 wget --help



例如,如果您使用GnuWin32 wget ,您可以使用:

  wget -OC:\cygwin\home\yourname\output-file$ url

而使用Cygwin wget ,您可能使用:

  wget -O/ home / yourname / output-file$ url

我始终发现最简单的方法是尽可能使用Cygwin可执行文件。


I am having trouble executing a program located in the "C:\Program Files (x86) directory in Windows from within Cygwin. Anyone know the trick to getting this to work?

jboss@QA024 /cygdrive/C/jboss/EAP-6.0.1/jboss-eap-6.0/bin
$ wgetexe="/cygdrive/C/Program Files (x86)/GnuWin32/wget.exe --help"

jboss@QA024 /cygdrive/C/jboss/EAP-6.0.1/jboss-eap-6.0/bin
$ bash $wgetexe
bash: /cygdrive/C/Program: No such file or directory

jboss@QA024 /cygdrive/C/jboss/EAP-6.0.1/jboss-eap-6.0/bin
$ bash "$wgetexe"
bash: /cygdrive/C/Program Files (x86)/GnuWin32/wget.exe --help: No such file or directory

解决方案

Try this:

wgetexe="/cygdrive/C/Program Files (x86)/GnuWin32/wget.exe"
"$wgetexe" --help

Since it's an executable, you don't want to pass it as an argument to bash, which will try to execute it as a script. Since it has spaces in the path name, you need to quote the name so the shell doesn't try to execute cygdrive/C/Program with invalid arguments.

You should also be able to add the directory to your $PATH:

PATH="$PATH:/cygdrive/C/Program Files (x86)/GnuWin32"

Keep in mind that GnuWin32 programs are Windows executables, and any file paths they use will be interpreted using Windows syntax. Cywin executables (anything that uses cygwin1.dll) use Cygwin path syntax.

Better yet, install the Cygwin version of wget and just invoke it as wget --help.

For example, if you're using the GnuWin32 wget, you might use:

wget -O "C:\cygwin\home\yourname\output-file" "$url"

whereas with the Cygwin wget you might use:

wget -O "/home/yourname/output-file" "$url"

I've always found it easiest to use Cygwin executables from Cygwin whenever possible.

这篇关于Cygwin路径到/ cygdrive / C /程序文件(x86)/ GnuWin32目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆