Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:56:06+00:00 2026-06-06T18:56:06+00:00

Under Windows 7 I have a batch file for checking the status of some

  • 0

Under Windows 7 I have a batch file for checking the status of some repos and outputting the returns to a file (with standard powershell issued git commands).

This works fine when launched from git shell, my question is how can I do this without launching git shell first?

So I want to be able to enter in a standard prompt or in a runnable batch file a command / commands which will launch a given batch file in git shell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:56:07+00:00Added an answer on June 6, 2026 at 6:56 pm

    If you consider what git-cmd.bat does, all you need to do is to set the right variable %PATH% before your git commands in your script:

    If you don’t, here is what you would see:

    C:\Users\VonC>git --version
    'git' is not recognized as an internal or external command,
    operable program or batch file.
    

    I have uncompressed the latest portable version of msysgit.

    Put anywhere a test.bat script (so no powershell involved there) with the following content:

    @setlocal
    
    @set git_install_root="C:\Users\VonC\prg\PortableGit-1.7.11-preview20120620"
    @set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%PATH%
    
    @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
    @if not exist "%HOME%" @set HOME=%USERPROFILE%
    
    @set PLINK_PROTOCOL=ssh
    
    REM here is the specific git commands of your script
    
    git --version
    echo %HOME%
    git config --global --list
    

    Make sure HOME is correctly set, because Git will look for your global git config there.

    The result will give you:

    C:\Users\VonC>cd prog\git
    
    C:\Users\VonC\prog\git>s.bat
    
    C:\Users\VonC\prog\git>git --version
    git version 1.7.11.msysgit.0
    
    C:\Users\VonC\prog\git>echo C:\Users\VonC
    C:\Users\VonC
    
    C:\Users\VonC\prog\git>git config --global --list
    user.name=VonC
    

    Note: that same script would work perfectly from a powershell session.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a complicated batch file (under windows), let's call it BigMess.bat. It makes
I have some existing code that worked fine under Windows 2003, to obtain the
I'm confused with file moving under python. Under windows commandline, if i have directory
I have modified my etc/hosts file (under Windows 7), so that www.example.com and demo.example.com
I have a batch script under Windows. When anyone will click on that script
I have created a folder under Windows\system32 with a config file in it. For
Under Windows, I have used a program called Dependency Walker to examine the libraries
I have IIS running under Windows XP. I have .html files with classic ASP
Imagine I have an existing process running under windows as a particular user. Would
I have a game that currently runs under Windows and Mac OS X and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.