UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

How can I set the path variable?

Sometimes we may want to run a program from the command line. For example, we may want to run MPLUS or HLM from the command line. This requires that the PATH environment variable to include the location of the programs. 

Let's say we want to add HLM to the path variable so we can run HLM from command line from any directory. First we have to know where the executable program for HLM is. One way  to locate the program is to look at its properties. Right click on the program (in our case, HLM) icon and choose Properties, we will see a window similar to the following. 

The Target field stores the location of the executable WHLM.exe. We are ready to add C:\StatApps\HLM504_rental12 to the PATH variable.


Windows 95/98

In Windows 95/98, environment variables are set in the autoexec.bat file. This file is usually located at C:\. Here is a sample autoexec.bat file.

SET COMSPEC=C:\WINDOWS\COMMAND.COM
SET windir=C:\WINDOWS
SET winbootdir=C:\WINDOWS
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;
SET PROMPT=$p$g
SET TEMP=C:\WINDOWS\TEMP
SET TMP=C:\WINDOWS\TEMP

The PATH is a list of directories to be searched when a command is issued from the command line. The directories are separated by semicolons. We usually edit this file using a simple text editor, such as Notepad. We can modify the PATH by adding the directory to the end:

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\StatApps\HLM504_rental12;

Or, you can append the directory to the end of the existing PATH like this: 

PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;
PATH=%PATH%;C:\StatApps\HLM504_rental12;

After modifying the file, we save it and reboot the machine. 


Windows 2000

On a Windows 2000, go to the Start menu and select menu item Settings, followed by Control Panel. In the window that opens, select System. Click on the Advanced tab, and then click on the Environment Variables button.

From the System variables box, select variable Path and click on Edit. We can add C:\StatApps\HLM504_rental12 at the end as shown below.

If variable Path does not exist, we can click on New to create the variable and edit its value in the same way shown above.


Windows NT

On Windows NT, go to the Start menu and select menu item Settings, followed by Control Panel. In the window that opens, select System. Click on the Environment tab. From the User Variables box, select  variable path. We can add C:\StatApps\HLM504_rental12 at the end of the Value field.

If the variable path does not exist, enter path in the Variable field and enter C:\StatApps\HLM504_rental12 in the Value field.
Finally we click on the Set button to update the changes and reboot the machine.


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.