我怎样才能文件关联.SH与Cygwin的? [英] How can I associate .sh files with Cygwin?

查看:236
本文介绍了我怎样才能文件关联.SH与Cygwin的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过双击Windows中的一个sh文件运行在Cygwin中长rsync命令。它必须在启动文件的所在目录(例如/ cygdrive / C /脚本/),以便相对路径工作。任何人都得到了这个工作?

I'd like to run a long rsync command in Cygwin by double clicking on a .sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work?

注:我只是发现 chere ,用于管理Windows中的Cygwin包上下文菜单(bash提示符这里)。它可能有一些线索。

Note: I've just found chere, a Cygwin package that manages Windows context menus (Bash Prompt Here). It might have some clues.

推荐答案

好吧,我发现一些作品。关联一个批处理文件弗拉基米尔建议没有工作,但在bash参数是关键。

Ok, I've found something that works. Associating a batch file as Vladimir suggested didn't work, but the bash arguments were key.

简短而亲切:联想用这个命令:C:\\ cygwin的\\斌\\ bash.exe-li%1%*

Short and sweet: associate with this command: "C:\cygwin\bin\bash.exe" -li "%1" %*

长版本,如果你不知道如何:

Long version if you don't know how:


  1. 在资源管理器中,去工具/文件夹选项/文件类型。

  2. 我已经拥有bash脚本的SH条目。如果您还没有一个,点击新建,然后输入SH来创建一个。

  3. 与SH扩展选择,单击高级。

  4. 选择打开操作,并单击编辑(或创建操作)。

  5. 这是使用命令:C:\\ cygwin的\\斌\\ bash.exe-li%1%* 。注意,如果没有在 -li ,有人returing在我的剧本命令未找到。

  1. In Explorer, go to Tools/Folder Options/File Types.
  2. I already had an SH entry for Bash Script. If you don't have one, click New and enter "SH" to create one.
  3. With the SH extension selected, click Advanced.
  4. Choose the "open" action and click edit (or create the action).
  5. This is the command to use: "C:\cygwin\bin\bash.exe" -li "%1" %*. Note that without the -li, it was returing "command not found" on my scripts.

您可能还需要为 SH 添加到您的 PATHEXT 环境变量:

You may also want to add SH to your PATHEXT environment variable:

维琪+暂停/高级/环境变量/系统变量/ PATHEXT

WinKey+Pause / Advanced / Environment Variables / System Variables / PATHEXT

感谢您的帮助,伙计们!

Thanks for your help, guys!

这篇关于我怎样才能文件关联.SH与Cygwin的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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