Windows 7 Forums Search
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows 7. The Windows 7 forum also covers news and updates and has an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7 - Windows doesn't seem to keep my system environment variables

 
07-25-2010   #1


Windows 7 64bit
 
 

Windows doesn't seem to keep my system environment variables

Hi all,

As far as I can tell, my problem seems to be quite simple. The solution, however, may not be quite as simple.

The application I am trying to make work is python 3. I also have python 2 installed, but that works fine.

The problem is at the command prompt I would like to be able to type
Code:
python3
and have it launch the python 3 shell. Currently, all I get is
Code:
'python3' is not recognized as an internal or external command,
operable program or batch file.
If I type
Code:
C:\Users\Jazzvibes>python
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
it already launches python 2 (which is correct).

I have already tried to put python3 as a system and user environment variable, in As far as I know the same way as python is set up. I changed this at the system properties window and then going to environment variables on the "Advanced" tab.

if I type
Code:
set
at the command prompt, I believe it should confirm this (please correct me if i'm mistaken)
Code:
python=C:\Python26\python.exe
python3=C:\Python31\python.exe
So, have I done something wrong, or left a step out? Please let me know if you need more info.

I should point out that typing a hard link to python3 using the address above does work, but I would like the shortcut for convenience (and to work out why it doesn't work in the first place)

My system for the record is Windows 7 64bit. Although both python installations are 32 bit versions (although i'm fairly sure that is trivial)

Regards,
Jazzvibes


Last edited by jazzvibes; 07-25-2010 at 11:30 PM.. Reason: clarification
My System SpecsSystem Spec
07-26-2010   #2


Windows 7 Ultimate x64
 
 


I have never done anything like you are attempting to do. (Setting up an alias for an executable)

I would tackle the problem by creating .cmd or .bat files that are in the path that then calls the proper executable and passes along all parameters.

For example, your batch file for python 3 would be called python3.bat (captain obvious to the rescue ) and you would include the following code:

Code:
 
C:\Python31\python.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
I'm not sure you need to include all of those command line parameter pass-throughs but it can't hurt.
My System SpecsSystem Spec
07-26-2010   #3


 
 


Add C:\Python31 to the end of the existing path environment variable. You do this by adding a ; (semi colon) then the path to C:\Python31. That will make it accessible from a Command Prompt.
My System SpecsSystem Spec
.


07-26-2010   #4


Win 7 Home Premium (64-bit), Win 7 Pro (32-bit)
 
 


In order to access your environment variable from the command line you need to bracket it with % like this: %python3%. In order to use the environment variable in a batch file you need to bracket it with %% like this: %%python3%%
My System SpecsSystem Spec
07-27-2010   #5


Windows 7 64bit
 
 


Woah thanks! Some good working solutions.
ZTruker has suggested the one that is most like the original though. I looked in the path variable to find C:\Python26, and added C:\Python31 and now it works exactly as expected.

the batch file method and the %python3% method both worked well too.
My System SpecsSystem Spec
Reply

 Windows doesn't seem to keep my system environment variables problems?



Thread Tools



Similar Threads for: Windows doesn't seem to keep my system environment variables
Thread Forum
Solved accidentally deleted path in environment variables System Security
Edit Environment Variables via command line Performance & Maintenance
Windows 7 Environment Variables List Performance & Maintenance
Environment variables to point to the Java compiler General Discussion
Java, Windows 7 & Environment Variables Software


All times are GMT -5. The time now is 09:49 PM.



Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30