Adding directories to your PATH in Windows
What’s the PATH and why do I care?
When you type a command in the shell, the computer only looks in a few special folders to see if that program exists. This list of folders is called the PATH.
Sometimes you install new software that you want your terminal to be able to find. To teach your computer where this software is, you add a directory to the PATH.
It’s done a thousand different ways across different installations of Windows, so we’re just going to do it using Cmder. That way as long as we’re using Cmder it will know to search in those directories.
Adding folders to the PATH in Cmder
First, find the folder you want to add to your PATH in Windows Explorer. Right-click the address bar up top and select Copy address.
Sometimes you already know the directory, and you can just type it in the next step instead of copying it.
In this case, the new path we want to add is C:\Program Files\PostgreSQL\11\bin
.
Open up Cmder and go into the settings, then Startup > Environment.
Since we want to add C:\Program Files\PostgreSQL\11\
to our PATH, we add the line
set PATH=C:\Program Files\PostgreSQL\11\bin;%PATH%
The %PATH%
part is the existing path. We’re saying “set the new PATH to be this folder, plus whatever was in the old path.” Click Save Settings.
Re-start Cmder and you should be able to run your commands without a problem!
If your command is still missing, try typing echo %PATH%
to see what your PATH looks like. Does it have the folder you added? Make sure you restarted Cmder!