Windows – How to set the default application to open a single file on Windows 7 and 8

windows 7windows 8

When I double-click the file my_app.py, I want to open it with python.exe. When I double-click any other .py file, I want to open it with a text editor. How do I set this up in Windows 7 and 8?

Here is what I tried:

  1. Right-click my_app.py

  2. Click "Properties"

  3. In the "General" tab, under "Opens with", click "Change"

  4. There is a checkbox labeled "Always use the selected program to open this kind of file". Perfect, I just need to uncheck this box. Unfortunately, the box is grayed out and checked, I cannot uncheck it.

How do I uncheck this box? Why is it grayed out?

Thank you.

Best Answer

An indirect solution will be to associate .py with a batch file (or autohotkey?). The batch file should check the file name and invoke python if it is my_app.py and text editor if it is not.

Otherwise I don't think you can open one file with a certain extension with one application and the remaining files with the same extension with another application, directly in Windows. Windows sees the extension and opens the associated file. The option "Always use the selected program to open this kind of file" is just to say if you want windows to automatically open the file with this application or ask every time you double click.

Related Question