Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Add the path to Mongo to my $PATH in git-bash:

jcollum@MACHINE /c/Program Files/mongodb-win32-x86_64-2.2.2/bin                                                           
$ PATH=$PATH:/c/Program\ Files/mongodb-win32-x86_64-2.2.2/bin                                                                 

jcollum@MACHINE /c/Program Files/mongodb-win32-x86_64-2.2.2/bin                                                           
$ echo $PATH                                                                                                                  
/c/Users/jcollum/bin:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/ConEmu/ConEmu:/c/Windows/system32:/c/Windows:/c/Windows
/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files/TortoiseGit/bin:/cmd:/c/Program Files/Microsoft/We
b Platform Installer/:/c/Program Files (x86)/Microsoft ASP.NET/ASP.NET Web Pages/v1.0/:/c/Program Files (x86)/Windows Kits/8.0
/Windows Performance Toolkit/:/c/Program Files/Microsoft SQL Server/110/Tools/Binn/:/c/Program Files/mongodb-win32-x86_64-2.2.
2/bin                                                                                                                         


jcollum@MACHINE /c/Program Files/mongodb-win32-x86_64-2.2.2/bin
$ which mongod
/c/Program Files/mongodb-win32-x86_64-2.2.2/bin/./mongod

That all looks right. But when I start a new console or restart ConEmu, the path is gone. Is it possible to get these changes to 'stick' using Git-Bash on Win7?

Got the 'how to' for PATH here:

http://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path

share|improve this question

migrated from stackoverflow.com Jan 4 '13 at 5:59

This question came from our site for professional and enthusiast programmers.

    
Edit the PATH variable in your .bashrc file. – Blender Jan 3 '13 at 22:42
up vote 3 down vote accepted

When you start new console - it inherits environment strings (%PATH% also) from parent process (ConEmu).

When you change %PATH% in your shell - it applies to this shell and its children processes.

If you need to fixate this temporarily environment changes - you may execute

ConEmuC /export PATH

This will "copy" your current %PATH% value to ConEmu GUI and it will be applied to all new ConEmu's consoles.

BTW, why you not tag your question with "conemu"?

share|improve this answer
    
Wasn't sure that it was relevant, since I'm running git-bash inside of ConEmu. I gotta say, you are really on top of any ConEmu posts on the SO network. Well done sir! – jcollum Jan 4 '13 at 17:10
    
Oh I'm getting this (120727c x64): Parsing command line failed (/C argument not found): "c:\Program Files\ConEmu\ConEmu\ConEmuC.exe" "C:/Program Files (x86)/Git/export" PATH – jcollum Jan 4 '13 at 17:17
    
First of all, update to the latest ConEmu version. Also, as far as I remember, switches started with "/" char must be escaped, may be ConEmuC //export PATH will help. – Maximus Jan 4 '13 at 18:33

You need to put that PATH setting command into your .bash_profile or .bashrc file. Just setting it at the command prompt only does it for your currently active shell.

share|improve this answer
    
OK but can I edit the PATH and make that 'stick' in Windows? Windows proper doesn't know about .bash_profile. – jcollum Jan 3 '13 at 23:44
    
@jcollum, your git-bash does, though. It has to get it from somewhere. Check your docs. YOu might get away with it by adding it to the system path (My Computer->Properties->Advanced->Edit Environment Variables or something like that, IIRC). – Carl Norum Jan 3 '13 at 23:52
    
Right, I should have mentioned I know how to do it the 'standard' way in windows, I was just curious why that wasn't getting down to the real %PATH%. I suppose git-bash is grabbing the windows path variable and then appending any values from .bash_profile. – jcollum Jan 4 '13 at 0:58

As Carl said, setting PATH at the command prompt does not create a lasting effect.

Try adding:

export PATH=$PATH:/c/Program\ Files/mongodb-win32-x86_64-2.2.2/bin 

to a file called .bashrc under your home directory. For Windows, this is usually located at C:\Users\<your user name> folder. You can find out for sure by using echo $HOME.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .