TortoiseHg: ‘hg’ is not recognized as an internal or external command, operable program or batch file
Asked Answered
U

2

17

I'm unable to find the command line tools in Mercurial-TortoiseHg version 2.7.2. I checked for hg.exe file and it is present at C:\Program Files\TortoiseHg path but whenever I try running the command it fails and throws the error :

‘hg’ is not recognized as an internal or external command, operable program or batch file.

I have also added it to the windows PATH= ; C:\Program Files\TortoiseHg.

Not sure what else to look for. Please help.

Urceolate answered 6/5, 2013 at 12:59 Comment(2)
Is the new PATH setting visible in your command line console (e.g. with 'set PATH')? If it isn't, try again with a new command line console. Environment variable changes are read when the console is started. Any changes won't be visible in consoles that were started before the change.Halfblooded
Yes, I've restarted the command line a couple of times and checked that as well. The path shows correctly but again the "hg" command doesn't run.Urceolate
S
24

Notes:

set PATH=%PATH%;C:\Program Files\TortoiseHg

(no space between ';' and 'C:\...')

As mentioned by the OP Sowmya Guru, if you modify the user environment variable, a restart (or at least a new DOS windows) is necessary.

Sail answered 6/5, 2013 at 13:12 Comment(3)
Yes, the space was the issue! :) And also needs a restart for environmental variables to apply. Thanks a lot. Very helpful.Urceolate
Also if both hg.exe and thg.exe files are present then both hg and thg commands can run in the command line not necessarily only thg.Urceolate
@SowmyaGuru very true: once the PATH is correctly set, any executable within that PATH is available.Sail
P
1

Posting my answer related to vanilla Mercurial install (not 'TortoiseHg') as it was the first page in search results, my solution was to use the 'Mercurial-3.4 (64-bit msi)' installer instead of the 'Mercurial-3.4 (64-bit exe)' from this page.

Perlie answered 1/6, 2015 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.