2

I seem to have edited some setting for windows command prompt in windows 7 and forgot.
[EDIT: it was just set as the default application for .py files in windows explorer. Dennis answered it below]

(sidenote: what is the correct way to refer to this prompt? should I call it wondows command prompt? cmd.exe? cmd? ms-dos? dos?)

whenever I enter the path to a python file, it opens that file in an editor (vim) instead of executing it. Where can you edit default actions for filetypes? Why can't I execute a .py file? why does it open an editor instead of executing the file?

Thanks!

1
  • 3
    "Windows command prompt" is correct. You can also use "cmd prompt". If you use "ms-dos" or "dos" you're likely to hear objections since it's not technically DOS (however, it quacks and walks a lot like DOS). Feb 5, 2011 at 8:22

1 Answer 1

5

Try the following

assoc | findstr "\.py"

You should get the following results:

.py=Python.File
.pyc=Python.CompiledFile
.pyo=Python.CompiledFile
.pyw=Python.NoConFile

and

ftype | findstr "Python"

should give you:

Python.CompiledFile="C:\Python27\python.exe" "%1" %*
Python.File="C:\Python27\python.exe" "%1" %*
Python.NoConFile="C:\Python27\pythonw.exe" "%1" %*

If any of those are missing, commands such as the following examples should fix them:

assoc .py=Python.File
ftype Python.File="C:\Python27\python.exe" "%1" %*

Also, in Windows Explorer, right click on a .py file and select Open with... and see if it says python.exe or vim.exe. If it's wrong, you should be able to change it there.

4
  • thank you. I tried it and these all returned the expected results - nothing was missing. Feb 5, 2011 at 8:37
  • Pipe both assoc and ftype through findstr "vim" to see if anything unusual shows up. Also, in Windows Explorer, right click on a .py file and select Open with... and see if it says python.exe or vim.exe. If it's wrong, you should be able to change it there. Feb 5, 2011 at 8:45
  • can you repost the windows explorer suggestion as an answer so I can give it a big fat green check mark? Feb 5, 2011 at 8:52
  • @Benjamin: Done. Feb 5, 2011 at 8:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .