What are Path Variables in Windows?

Path variables are a set of directories that contain executable programs that can be executed using a terminal from any directory within the operating system.

Path variables can allow you to create, or use already existing, programs within the command prompt or bash terminal from any directory or place within the operating system. For example, you could install a program with executables such as PHP, NPM or Maven, add them to your path variables and then use them in any folder to run scripts or processes. You could also run an executable by specifying the absolute path to the executable.

Path variables are an important aspect to understand when programming as it can allow you to create shortcuts or quick ways to access other executables that are installed in your system. For example, imagine you install Maven, which is a project management tool that allows you to compile, build, and run processes on source code. If you don’t add the maven bin folder to your path variables you would have to specify the absolute path the bin folder of the Maven installation folder.

"C:\Program Files\Maven\bin\mvn" clean install

If you add Maven’s bin folder to your path variables you can access the ‘mvn’ executable without having to use the absolute path. It makes everything in the bin folder globally accessible within the terminal.

mvn clean install

Leave a Reply