从命令行启动 Beyond Compare

发布于 2024-08-31 17:19:42 字数 1012 浏览 6 评论 0原文

我已安装 Beyond Compare 3;

"C:\Program Files\Beyond Compare 3\BCompare.exe"

和西格温;

"C:\Cygwin\bin\bash.exe"

我想要的是能够使用诸如以下的命令;

diff <file1> <file2>

进入 Cygwin shell 并让 shell 分叉一个进程,以无法比较的方式打开这两个文件。

我查看了 Beyond Compare 支持页面,但恐怕它对我来说太短暂了。我尝试逐字复制文本(除了可执行文件的路径),但无济于事;

Instead of using a batch file, create a file named "bc.sh" with the following line:
"$(cygpath 'C:\Progra~1\Beyond~1\bcomp.exe')" `cygpath -w "$6"` `cygpath -w "$7"` /title1="$3" /title2="$5" /readonly 

我应该更换 cygpath 吗?当我在命令行上输入脚本名称时,出现“找不到命令”错误。

gavina@whwgavina1 /cygdrive
$ "C:\Documents and Settings\gavina\Desktop\bc.sh"
bash: C:\Documents and Settings\gavina\Desktop\bc.sh: command not found

有人像我描述的那样使用 Beyond Compare 工作吗?这在 Windows 环境中可能吗?

提前致谢!

I have Beyond Compare 3 installed at;

"C:\Program Files\Beyond Compare 3\BCompare.exe"

and Cygwin;

"C:\Cygwin\bin\bash.exe"

What I would like is to be able to use a command such as;

diff <file1> <file2>

into the Cygwin shell and to have the shell fork a process opening the two files in beyond compare.

I looked at the Beyond Compare Support Page but I'm afraid It was too brief for me. I tried copying the text verbatim (apart from path to executable) to no avail;

Instead of using a batch file, create a file named "bc.sh" with the following line:
"$(cygpath 'C:\Progra~1\Beyond~1\bcomp.exe')" `cygpath -w "$6"` `cygpath -w "$7"` /title1="$3" /title2="$5" /readonly 

Was I supposed to replace cygpath? I get a 'Command not found' error when I enter the name of the script on the command line.

gavina@whwgavina1 /cygdrive
$ "C:\Documents and Settings\gavina\Desktop\bc.sh"
bash: C:\Documents and Settings\gavina\Desktop\bc.sh: command not found

Does anyone have Beyond Compare working as I have described? Is this even possible in a Windows environment?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

青萝楚歌 2024-09-07 17:19:42

Cygwin 内部的文件系统更像 unix。 cygpath 组件之所以存在,是因为驱动器的根目录出现在路径中的不同位置。 “C:\”对 Cygwin 来说没有任何意义,它认为“/”是根目录,您的驱动器必须从那里开始,因此 cygpath 扩展。另外,尝试使用 8.3 表单,如引用页面中所示:

“$(cygpath
'C:\Progra~1\Beyond~1\bcomp.exe')"

Inside of Cygwin the filesystem is more like unix. The cygpath component is there because the root of the drive appears in a different place in the path. "C:\" doesn't mean anything to Cygwin, it considers '/' to be the root and your drives have to start from there, hence the cygpath expansion. Also, try using the 8.3 form like from the referenced page:

"$(cygpath
'C:\Progra~1\Beyond~1\bcomp.exe')"

烟沫凡尘 2024-09-07 17:19:42

将此函数添加到您的 ~/.bashrc 文件中。

bc() {
  "/cygdrive/c/Program Files/Beyond Compare 3/BCompare.exe" $1 $2 -fv "Text Compare"
}

然后,您可以在命令行上编写 bc file1.txt file2.txt 并使用 Beyond Compare 获得良好的文本比较。

Add this function to your ~/.bashrc file.

bc() {
  "/cygdrive/c/Program Files/Beyond Compare 3/BCompare.exe" $1 $2 -fv "Text Compare"
}

Then you can just write bc file1.txt file2.txt on the command line and get a nice text comparison using Beyond Compare.

冷心人i 2024-09-07 17:19:42

@Romain Hippeau 谢谢,我有点白痴。

要在 Cygwin 中运行 shell 脚本,您必须使其可执行。

chmod 755 bc.sh 

然后运行脚本使用;

./bc.sh

脚本位于当前目录中的位置。

@Romain Hippeau Thanks, I was being a bit of a moron.

To run a shell script in Cygwin you have to make it executable.

chmod 755 bc.sh 

Then to run the script use;

./bc.sh

Where the script is in the current directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文