如何从 Windows 命令行启动 Git Bash? [英] How To Launch Git Bash from Windows Command Line?

查看:175
本文介绍了如何从 Windows 命令行启动 Git Bash?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望是一个简单的问题,但我还没有找到答案.我想从 Windows 批处理文件启动 Git Bash.这是我迄今为止尝试过的:

I've got what I'm hoping is a simple question, but I haven't been able to find the answer yet. I would like to launch Git Bash from a Windows batch file. Here is what I tried so far:

  1. 从 Win 7 开始按钮启动 Git Bash

  1. Launched Git Bash from Win 7 Start button

使用 CTRL+ALT+DEL 将进程标识为sh.exe"

Used CTRL+ALT+DEL to identify the process as "sh.exe"

使用启动命令从批处理文件中启动 sh.exe

Launched sh.exe from batch file using start command

 start sh.exe

然而,这不会启动完整的 Git Bash 环境.Git Bash 通常有MINGW32"在标题栏中,但 sh.exe 具有到 ... Gitinsh.exe 的完整路径.在我看来,有一些我可能不知道的覆盖或依赖项,它们也需要加载(拉入?导入?).

However, this does not launch the full Git Bash environment. Git Bash usually has "MINGW32" in the title bar, but sh.exe has a full path to ... Gitinsh.exe. It feels to me like there are some overlays or dependencies that I'm not aware of possibly, that also need to be loaded (pulled in? imported?).

这是我通过搜索网络找到的最佳结果之一,但对我来说并不完全有意义,我不确定它是否完全适用于我的情况:

This was one of the top results I found through searching the web, but it doesn't make complete sense to me and I'm not sure if it applies exactly to my situation:

从 Windows Cmd 行运行 git:在哪里关键文件?

我是 Windows 批处理脚本领域的初学者.

I'm a beginner in the world of Windows batch scripting.

推荐答案

如果您想从批处理文件启动:

If you want to launch from a batch file:

  • 用于 x86

  • for x86

start "" "%SYSTEMDRIVE%Program Files (x86)Gitinsh.exe" --login

  • 用于 x64

  • for x64

    start "" "%PROGRAMFILES%Gitinsh.exe" --login
    

  • 这篇关于如何从 Windows 命令行启动 Git Bash?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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