gpt4 book ai didi

windows - `gitk` 使用`where`命令找到程序但无法执行?

转载 作者:可可西里 更新时间:2023-11-01 10:35:04 26 4
gpt4 key购买 nike

我正在尝试运行 gitk在 Windows 上,但控制台给了我:

'gitk' is not recognized as an internal or external command,
operable program or batch file.

但是,我可以做到

> where gitk
C:\Program Files (x86)\Git\bin\gitk

怎么来的?

最佳答案

更新:窃取 OP 的评论:

Thanks for a (lengthy) explanation, the easiest fix for me was to move from the old msysGit (1.9.5) version to the newer "Git for Windows" builds which has a proper Windows wrapper for gitk.


gitk 与大多数 git 命令不同,它是一个调用 Tcl 的 shell 脚本。

如果您检查 gitk 可执行文件本身,它的前几行是:

#!/bin/sh
# Tcl ignores the next line -*- tcl -*- \
exec wish "$0" -- "$@"

(至少在我的 Linux 系统上是这样;gitk 的 Windows 安装程序可能会改变这一点。)

在类 Unix 系统上,第一行称为 "shebang" , 告诉系统调用 /bin/sh 来执行文件而不是直接执行它。

第三行执行wish命令,将脚本作为Tcl脚本执行。

如果你的 Windows 系统上安装了 Tcl,你应该能够使用像这样的东西将 gitk 作为 Tcl 脚本运行:

C:\> tclsh "C:\Program Files (x86)\Git\bin\gitk"

(免责声明:我没有尝试过。)

您还可以将命令的名称从 gitk 更改为 gitk.tcl 并在 Windows 中设置文件关联以便正确调用它。 (我有点惊讶 Windows git 安装程序没有为你做这件事。)

可以找到有关在 Windows 上运行 Tcl 脚本的更多信息 here .

this question讨论了从上下文菜单而不是从命令行在 Windows 上调用 gitk

关于windows - `gitk` 使用`where`命令找到程序但无法执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31906647/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com