# Python environment variable Windows 8



## cmptechinfo (Apr 30, 2014)

I'd like to do some work, just for myself, with Python on a Windows computer, Windows 8. Cannot find the autoexec.bat file. Would like to put the path 
PYTHONPATH=%PYTHONPATH%;C:\Python27 into the autoexec.bat 
file but there is no such file.

I can add this to the ControlPanel/System and Security/System/Advanced
system settings/Adanced/Environment Variables... window in the User 
variable window. I entered:
Variable PYTHONPATH 
Value %PYTHONPATH%;C:\Python27

But, every time that I shut off the computer, I loose that path
and have to enter it again.

I'd have posted to the IT Forum but that "says" that it is for businesses and this is just for me.

Any suggestions?:angel:

Thank you


----------



## Go The Power (Mar 5, 2007)

Hello cmptechinfo

We can try and these via the registry,

Do you know if this has to be a *system variable* or a *user variable*?

First thing to do is to open *Regedit*. Press the 'windows key' on the keyboard + *R* at the same time -> Type in *regedit*

*For User Variable*


Navigate too *HKEY_CURRENT_USER\Environment*
Click on *Edit* -> *New* -> *Expandable String Value* -> Call it * PYTHONPATH* -> Double click on * PYTHONPATH* -> Set it too *%PYTHONPATH%;C:\Python27*

*For System Variable *


Navigate too *HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment*
Click on *Edit* -> *New* -> *Expandable String Value* -> Call it * PYTHONPATH* -> Double click on * PYTHONPATH* -> Set it too *%PYTHONPATH%;C:\Python27*


----------



## cmptechinfo (Apr 30, 2014)

Thank you.
That works.

Hmmmm, I have another question.

I installed Python 2.7.n 
Along with the installation there is a GUI, which I understand how to use.
But there is also a "Python Command" window which I do not understand.
In which directory do I save the *.py files?
Do I just type the name of the file then to run it?

Thanks. :angel:


----------



## Go The Power (Mar 5, 2007)

Sorry I have never used Python. I just know how to fix the environmental variables issue.

If you do add the file inside that folder are you able to execute to it?


----------

