Posts tagged ‘cmd program’
How To Set Environment Variables in Windows ?
You want to run a program from command line (CMD program) of Windows and you hate to retype the long path to that program very time you use it? Like me, I am also lazy to do this job every time I compile and run a Java program. Luckily, there is an easy solution to help us same time on running programs. That is setting Environment Variables.
But what are “Environment Variables”? Oh! They are variables, simply (like any variables that you declare and use while you do programming…if you are a programmer). The only difference is that Environment Variables are defined by Operating System like Windows or Linux and you can edit them in the way you want. In this post, I show you how to change Environment Variables in Windows. For Unix / Linux/ Mac OS, please see my other post here. Below instructions are showed with the screenshots of Windows 7. It may be different on other Windows versions
1. From the desktop, right-click My Computer, and then click Properties.
2. Click the Advanced System Settings option (if you use Windows Vista or Windows 7, otherwise, go to next step)
3. Click the Advanced tab.
4. Click Environment variables.
5. In the User Variables section, choose a variable the you want to change (in this case I chose PATH) and then click Edit
6. Edit the value of variable in Variable Value box (e.g. I added the path of my program to the end of PATH string and separated it with other paths by semi-colon (;))
7. Click OK and you’ve done
PS: The System Variables are also Environment Variables but they apply to all computer users. If you change them, they will affect all other users. You must be an administrator to modify these system environment variables.