我得到了Ocaml for Windows,它与Cygwin预包装在一起。由于我希望能够从当前目录的命令行中打开mintty
,因此我将其添加到PATH中,然后仅运行mintty
就可以了。虽然这导致它在当前目录中打开,但问题是,当我运行任何Ocaml可执行文件(例如opam
)时,都会出现错误。
Marko@Lain /cygdrive/e/Webdev/Ocaml/todolist
$ opam
bash: opam: command not found
[当我像快捷方式一样使用mintty -
运行它时,这实际上是有效的。
Marko@Lain ~
$ cd "E:\Webdev\Ocaml\todolist"
Marko@Lain /cygdrive/e/Webdev/Ocaml/todolist
$ opam
usage: opam [--version]
[--help]
<command> [<args>]
The most commonly used opam commands are:
init Initialize opam state, or set init options.
list Display the list of available packages.
show Display information about specific packages.
install Install a list of packages.
remove Remove a list of packages.
update Update the list of available packages.
upgrade Upgrade the installed package to latest version.
config Display configuration options for packages.
repository Manage opam repositories.
switch Manage multiple installation prefixes.
pin Pin a given package to a specific version or source.
admin Tools for repository administrators
See 'opam help <command>' for more information on a specific command.
我该怎么做才能正常获得此行为?
此外,由于mintty
在独立窗口中运行终端,因此最好运行bash
,但bash -
对我不起作用。在使它起作用之后,我想将bash
添加到我的VS Code shell列表中,为此,我需要了解如何从命令行在任意目录中运行它,同时保留其对家庭环境。
此命令mintty -
以登录名身份启动您的Shell。如果运行非登录外壳程序,则大多数配置脚本都不会读取,并且环境是从父进程中获取的,但是您的链接当然会失败,因为Windows无法提供正确的链接。如果您希望能够从资源管理器中打开login shell
,最好的方法是安装chere
软件包
$ chere -h
/usr/bin/chere version 1.4
Usage:
/usr/bin/chere -<iuxlrhv> [-lracnmpf12] [-t <term>] [-s <shell>]
[-d <display> ] [-o <options>] [-e <menutext>]
Adds the stated terminal/shell combination to the folder context menu
This allows you to right click a folder in Windows Explorer and open
a Cygwin shell in that folder.
Options:
i - Install
u - Uninstall
x - Freshen eXisting entries
l - List currently installed chere items
r - Read all chere registry entries to stdout
a - All users
c - Current user only
n - Be Nice and provide Control Panel uninstall option (Default)
m - Minimal, no Control Panel uninstall
p - Print regtool commands to stdout rather than running them
f - Force write (overwrite existing, ignore missing files)
1 - Start using registry one-liners. This doesn't work with ash,
tcsh or network shares.
2 - Start via bash script. Relies on windows to change directory,
and login scripts avoiding doing a cd /home/Marco
h - Help
v - Version
t <term> - Use terminal term. Supported terminals are:
cmd rxvt mintty xterm urxvt
s <shell> - Use the named shell. Supported shells are:
ash bash cmd dash fish mksh pdksh posh tcsh zsh passwd
d <display> - DISPLAY to use (xterm, urxvt). Defaults to :0.
Set to env to use the runtime environment variable.
o <options> - Add <options> to the terminal startup command.
If more than one option is specified, they should all be
contained within a single set of quotes.
e <menutext> - Use <menutext> as the context menu text.
See the man page for more detail.
您可以将您的首选或默认外壳安装在资源管理器right click
菜单上作为附加项。它将在所选目录中打开一个login shell
。