Using Assoc command to associate an extension to program in Windows

24 Sep

I wanted to associate .php extension to sublime text editor but windows 10 was not going to make it simple..
After some googling and researching I found an answer.


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
“phpfile” this is what you need for the next part


Once you have the file type association that you would like to change. you will run the ftype command on it as follows

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.

Full description about the assoc command can be found here


If you get a response like “File association not found for extension” Then you need to create an association for that extension with the following command

assoc .(xxx)=(filetype)


assoc .cls=javaclass

Once the association is created verify with command on step 1. Then you can do the the association as in step 2.

Leave a comment

Posted by on September 24, 2019 in Windows


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: