What is Path variable?

The path is the environment variable that lets you access executable's even if they aren’t in the current directory when working at the command prompt. It basically is like a import statement that tells windows where to find the appropriate command to be executed.

How to set the path variable ?

For a Single Session:-

you can set the path environment variable for a single session in this case as soon as you exit the command prompt the path that you add will be deleted.

Syntax for this : PATH [[drive:]path[;...][;%PATH%]

In this we add %path% so that the older path be appended or included in the new path.
; is used as a separator.

For example : path c:\temp;%path%

Permanently Setting up the Path:-

For this case follow these steps :-
  • Right click the my computer icon and select properties.
  • Then choose advanced tab and press the environment variables button (as shown in the figure).

properties image

  • Now select the path variable and press edit and then append your path. For example: in case you have to append the path of java installation for that append C:/Program Files/Java/jdk1.6.0_07; to your path variable.

path image

That's it reopen the command prompt and the command will work.