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 3343866
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:00:14+00:00 2026-05-18T01:00:14+00:00

To clarify : The question is really: How do I locate the Mercurial command

  • 0

To clarify: The question is really: How do I locate the Mercurial command line client. If the answer is applicable to any executable, so much the better, but I’m really interested in the hg.exe executable file.

If I know the name of an executable, say hg.exe, the Mercurial command line client, and Windows knows where it is because I can execute just hg log from a command prompt and it executes, what steps are involved in order for me to find that executable myself, in the same manner that the command prompt and Windows does it?

Basically, if Windows is able to locate it, I want my program to be able to locate it.

Is there a WinAPI function, or similar? The code will run in .NET, written in C#, so if there’s anything built into .NET for this that would be the preferred solution, but otherwise I’m not adverse to using P/Invoke for this.

I’ve seen one potential duplicate of this question: c# Check if an executable exists in the windows path, but is that all there is to it? Just iterate over the contents of the PATH environment variable and looking in each of those directories for the executable?

I have a vague notion that that’s just one of the steps involved, and possibly that there are registry overrides that Windows can use that I should be aware of, so I’ll post the question here.

If, on the other hand, there really is just the PATH variable in play here, it can probably safely be closed as a duplicate.

  • 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-05-18T01:00:14+00:00Added an answer on May 18, 2026 at 1:00 am

    It depends on how the program is registered with the system. Since hg is generally run from either tools or the command line, it’s not going to be registered with the system. If it were there’s a set of registry keys that has the exe name and path. Otherwise, you just iter the path from the first entry to the last till you find the file you need. First one found on the path wins.

    Examples of such a “registered” program, excel or winword.

    EDIT:

    @BillyONeal makes a good point below, that only works for “run” command programs, but my point was there was a second place to look.

    Additionally, for those who haven’t seen this, here’s the install procedures:

    An alternative scheme that works better for some is to search for hg on the PATH

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

Sidebar

Related Questions

No related questions found

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.