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.

When I use the run prompt in Windows XP Professional (Win+R), and type python.exe or python, it works and greets me with the python prompt.

However, when I start a cmd window, and then type python.exe or python, it doesn't find it.

This is what I expect, as the Python directory (for me, I:\Python31\) is not in my PATH.

How come, then, that if I type python.exe in the Win+R prompt, it works?

Edit: here is a partial output of SET, I removed most irrelevant entries, I'm not sure why is it useful, apart from the PATH variable which I already said doesn't include the Python directory. If you need a particular variable other than these, please ask.

CLIENTNAME=Console
CommonProgramFiles=I:\Program Files\Common Files
ComSpec=I:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
OS=Windows_NT
Path=I:\WINDOWS\system32;I:\WINDOWS;I:\WINDOWS\system32\WBEM;I:\WINDOWS\system32\WindowsPowerShell\v1.0;I:\Qt\2010.05\mingw\bin;I:\Program Files\CMake 2.8\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
ProgramFiles=I:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=I:
SystemRoot=I:\WINDOWS
VBOX_INSTALL_PATH=I:\Program Files\Oracle\VirtualBox\
windir=I:\WINDOWS
share|improve this question
    
Could you edit your question to include the output of SET? You may want to edit it so that you name does not appear. –  paradroid Jan 3 '11 at 2:04
    
Posted parts of it, not sure how anything else than Path is relevant, do you want a specific variable? –  houbysoft Jan 3 '11 at 2:11
    
What's your working directory? –  digitxp Jan 3 '11 at 2:49

1 Answer 1

up vote 12 down vote accepted

the Run prompt searches a registry path for programs to launch as well as the %path%. Take a look at HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths - you'll likely find a node called "Python.exe" with the default entry pointing to the Python executable. Installers should add registry entries for all main executables here, but the Run prompt is an underappreciated feature, so a lot of developers forget to add this simple step to their installer.

share|improve this answer
    
Never knew about this myself, thanks for the answer! –  houbysoft Jan 3 '11 at 2:54
2  
Technically it is ShellExecuteEx() that does the lookup. –  grawity Jan 4 '11 at 14:18
1  
In fact, there are several places in the registry where paths are located, for example HKCR\Applications. One day I should clean them all out. –  Synetech Aug 2 '11 at 5:39

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.