24

For some reason lately I've experienced this issue with trying to set a default application for an extension. The most common ways are the following:

  1. Right Click > Open With > Choose Default Program This opens a dialog window with the option to browse any application to use for one-time only OR (by checking the appropriate checkbox) this would effectively set the default application for the selected filetype.

  2. Control Panel\Programs\Default Programs\Set Associations This settings page allows you to set the default program for every known filetype. Just as in option #1, you select the "change program" button and from the dialog window you selected the new default application

For many windows users this is nothing new, the problem is what about when the application I want doesn't appear in the options? I even browse and find the .exe file I want and select it and still it does not appear as an option.

How do I get the application to appear as an option so that I can set it as the default application?

nKn
  • 5,832

3 Answers3

41

After some googling I found an answer along with other forums with no sufficient answer so I thought this would make for a helpful post.

STEP 1

First you need to get the associated name of your file type. In the command prompt (be sure to run as Admin) run the following

  • assoc {filetype}

    For example:

    • assoc .php

      Should output .php=phpfile <- this is what you need for the next part

STEP 2

Once you have the filetype association that you would like to change you will run the ftype command on it

  • ftype {file_association}="absolute-path-to-application" "%1"

    For example:

    • ftype phpfile="C:\Dropbox\ST3\sublime_text.exe" "%1"

That command effectively added Sublime Text as a recommended application for phpfile type associations. Now when I use the normal windows methods for settings a default application it appears without even having to browse for it.

SUCCESS!

Full description can be found here

BONUS POINTS:

If you get a response like the following: File association not found for extention then you simply need to create an association for that extension with the following:

assoc .{XXX}={filetype}

For example:

assoc .cls=javaclass

Once the association is made which you can verify using the steps above, then you can proceed with associating it to a default application.

Ahmad Tn
  • 123
4

TFeldt posted this solution in the Sublime Forum (link):

  1. Open
  2. Navigate to HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command Verify that the path is accurate, correct it if it is not. Exit regedit.
  3. Open task manager via ctrl+alt+del, kill explorer.exe, go to run and type explorer.exe (or skip this step and simply reboot).
  4. Now attempt the same thing, right click a text file, open with, navigate to sublime, and it should now appear in the list of available applications.

The problem that I had was that the path wasn't updated when I changed to ST3 from ST2.

2

Thanks for all the help. I recently installed Sublime Text 3 on Windows 7 and it wasn't allowing me create certain file associations.

I had to use an elevated command prompt and the command ftype to do add the file associations.

For anyone interested in a speedy fix for common web-development files just run these commands individually (command console as administrator and from root C:):

ftype phpfile="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"

ftype CSSfile="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"

ftype txtfile="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"

ftype JSFile="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"

ftype xmlfile="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"

The confirmation message for each should read something like this=:

phpfile="C:\Program Files\Sublime Text 3\sublime_text.exe" "%1"

You get the idea... Now you can use these commands for any filetype and program.

Now all these filetypes should appear in the File Association (open with) dialog.

Not to drone on, but to add Sublime 3 to the right-click context menu here's a great fix that works well: http://wordpress-corner.com/add-open-sublime-text-3-windows-explorer-context-menu/

undo
  • 6,129