What is a path Variable and how is it useful!!!
PATH is an environment variable available on several platforms that specifies a set of directories where the executable programs are located.
It helps the programs to load easier and faster via Command prompt compared to GUI.
This can be a temporary change or permanent change.
How to Update this Variable
My Computer -> (Rightclick) Properties -> Advanced(Tab) -> Environment Varaibles (Button)
You will see a Dialog Box divided as
User Variables
System Variables
You would find the PATH variable in both User and System Varaibles. But i would suggest you to work with User vaiables only.
Double Click the Path Variable and APPEND the path of the folder to its value.
Remember, every Directory names we specify should be separated by semi colon.
In Windows 7
Select Computer from the Start menu
Choose System Properties from the context menu
Click Advanced system settings > Advanced tab
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by appending the location to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location as the value.
You can set temporary path variables using SET Command that will be active until the command prompt is closed.
How it Works?
When a command is entered in a command prompt or a system call is made by a program to execute a program, the system first searches the current working directory and then searches the PATH, examining each directory specified in the value of the Path Variable from left to right, looking for an executable filename that matches the command name given.
Once a matching file is found, the system initiates a new process in which to run it.
If the system doesn't know the type of the file specified, it shows us an Open With Dialog as expected.
A simple example..At what instance this would be more useful..
Say, you save each of your daily activities in a separate Notepad (ddmmyy.txt format) and you would have to fetch previous files of some date frequently, Instead of going into the folder and searching for the file every time, you can use the above concept of PATH Variable.
You can list the path of the folder that contains these files in PATH variable..and now you can straight away give the filename (ddmmyy.txt) in RUN Dialog or Command Prompt to access any file in that folder.
This is also useful to run java programs via command prompt.