How to add mongod to the command prompt in windows 10
Sometimes when installing software, it might not give you an option to set an environment variable. This happened to me with mongodb.
What are Environment Variables
An environment variable can be thought of as a path to an executable program. Having this set is useful if you want to run programs through the command prompt instead of having to open them in a file explorer.
How to add mongod to the environment Variables
Here are the steps to add mongod to the environment variables in Windows 10, after installing mongodb.
- Find the path to the mongodb folder in your program files.
- Then go to the bin folder
If you’re not sure where it is, it’s probably in
C:\Program Files\MongoDB\Server\4.0\. It should look like this:
- Copy the path of the bin folder, this should be
- Press the Windows key and then type “env”. (If you dont have a Windows key you can press ctrl and esc or
navigate to the start window.) Windows will suggest “Edit the system environment variables”, click it.
- In the Advanced tab, click “Environment Variables”.
- With the
Path variable highlighted in “System Variables”, click “Edit”:
- Click “New”
- Paste your path of the copied bin folder from earlier. Make sure it ends with a
\ like so:
- click “OK” until you are out of the system properties
Now you should be able to run
mongo from anywhere in the command prompt.