Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to add shortcuts for Python 32bit and 64bit to the PATH directory for the command line, one as python-32 and the other as python respectively. What's the easiest way to do this?

I have added C:\Python27 to the PATH variable, which means it finds C:\Python27\python.exe when I type python (correctly for my 64bit version). Is there a way I can redirect the python-32 command to point to C:\Python27-32\python.exe or will I have to rename the executable?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Renaming an executable can sometimes break something else (e.g. its path may be listed in some scripts or registry keys), but if that does not bother you in your case it might just work.

Alternatives to adding python directories to your PATH:

  • creating small scripts (.bat or .cmd) in a directory in your PATH; you are free to name those python/python-32 and let them fire up the correct python version (i.e. with full path)
  • adding python shortcuts (.lnk) to a directory in your PATH; you are also free to give those a suitable name, but then you need to explicitly add the .lnk extension to your command (unless you register this extension as an executable filename extension like .exe, .com, .bat or .cmd
    see echo %pathext%)
  • using any smart launcher application
share|improve this answer
    
So, I'm trying to make a batch file for the 32bit version. I've added its location to PATH. Now, how do I make it pass its parameters to the python command? –  Shashwat Jan 5 '13 at 11:23
1  
EDIT: I think this works: I'm using this currently: @echo off; c:\python27-32\python.exe %* Will it work in all cases? Is the %* usage correct? EDIT: Nvm. I'm nearly 100% sure it will work. –  Shashwat Jan 5 '13 at 11:24
    
Instead of @echo off; c:\…, you can also just put the @ in front of the actual command: @c:\…. –  mousio Jan 5 '13 at 11:28
    
Starting python this way will keep your prompt waiting for python to finish. If this is a problem, consider using start; explore its options with help start. –  mousio Jan 5 '13 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.