Associate a File Type with a Specific Program

16

6

How do you associate a specific file type to an application on a Windows (Vista) PC?

jdiaz

Posted 2009-08-25T22:56:17.780

Reputation: 271

It depends on .ext and as Windows has persistent associations in later OS Versions – Tony Stewart Sunnyskyguy EE75 – 2018-06-15T22:12:11.953

Answers

12

Method #1 (on the fly):

  1. Right-click a file of the type you want to change, and select Properties.
  2. In the General tab, click the Change button.
  3. Choose a program from the list, or click Browse to select an .EXE file on your hard disk.

Method #2 (view a list of file types):

  1. Open Control Panel.
  2. In Control Panel Home, click Programs, and then click Make a file type always open in a specific program.

    Or, in the Classic View, open Default Programs and then click Associate a file type or protocol with a program.

  3. Highlight a file type in the list and click Change Program.

Unfortunately, neither method in Vista allows you to choose anything but the default programs, such as the programs listed in your files' context menus. If you want complete control over your file types, use this tool:

Method #3 (File Type Doctor):

  1. Download and install Creative Element Power Tools.
  2. Open the Creative Element Power Tools Control Panel.
  3. Turn on the Edit file type associations option, and click Accept.
  4. Right-click a file of the type you want to change, and select Edit File Type to show this window:

alt text

Source

Molly7244

Posted 2009-08-25T22:56:17.780

Reputation:

1Creative Element Power Tools has been discontinued and is no longer supported. Instead use FileTypesMan – crazypotato – 2014-08-08T23:16:29.340

22

How about Method #5 (for people who like the command line):

  1. Open an elevated command prompt.
  2. Use FTYPE {fileType}={commandString} to create a file type and associated command to open the file.
  3. Use ASSOC {.fileExtension}={fileType} to associate a file extension with the file type you created.

Example:

FTYPE MyCustomType=C:\Program Files\MyCustomProgram\MyProg.exe "%1"
ASSOC .custom=MyCustomType

Note that many file types may already be registered on your system. You can list them all by just typing FTYPE with no arguments.

bobbymcr

Posted 2009-08-25T22:56:17.780

Reputation: 1 992

Something is wrong. Currently, .js files are opening with Sublime Text 2, and assoc .js command gives me .js=jsfile and ftype jsfile command gives me jsfile=%SystemRoot%\System32\WScript.exe "%1" %*. – Iulian Onofrei – 2014-07-06T15:07:18.647

thanks. I just tried with "assoc .=MyCustomType" for files with no extension, and it worked! – gulbrandr – 2010-11-21T19:43:29.807

4

Adding Method #4:

  1. Right click on a file of the type you wish to change
  2. Click Open With... (select Choose Default Program... if a sub-menu appears)
  3. Select the application you wish to open this type of file with. You can also click the browse option if Windows doesn't suggest what you want.
  4. Ensure the box labeled Always use the selected program to open this type of file is ticked

Ciaran

Posted 2009-08-25T22:56:17.780

Reputation: 4 078

You can add new files to the submenu this way without making them the default program. Just make sure the box mentioned in step 4 above is not ticked. (Note that there will be no "Open With..." item if the file doesn't currently have any programs associated with it.) – RobH – 2014-07-16T16:40:08.623

4

The following example .bat file show how to associate a file type with a specific program and icon will not be ugly:

enter image description here

set ftypename=potato_xxx_file
set extension=.potato
set pathtoexe="C:\potato.exe"
set pathtoicon=""

if %pathtoicon%=="" set pathtoicon=%pathtoexe%,0
REG ADD HKEY_CLASSES_ROOT\%extension%\ /t REG_SZ /d %ftypename% /f
REG ADD HKLM\SOFTWARE\Classes\%ftypename%\DefaultIcon\ /t REG_SZ /d %pathtoicon% /f
ftype %ftypename%=%pathtoexe% "%%1" %%*
assoc %extension%=%ftypename%

Some hints:

ftypename - FileType name can be random but should be unique.

extension - A filename extension. Examples of filename extensions are .png, .jpeg, .exe, .dmg

pathtoexe - Full executable path.

pathtoicon - Full path to icon or executable file with selected icon. If icon path empty then default icon from exe will be used. If want use custom icon change set pathtoicon="" for example to set pathtoicon="C:\icons\potato.ico".

Works atleast in Windows 7.

crazypotato

Posted 2009-08-25T22:56:17.780

Reputation: 678

2

I achieved the correct way of FILE ASSOCIATION using these cmd commands. this is just an example:

REG ADD "HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command" /v @ /t REG_SZ /d "\"C:\\Program Files\\Noteepad++\\notepad++.exe\" \"%1\"" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt" /v "Application" /t REG_SZ /d "notepad++.exe" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList" /v "g" /t REG_SZ /d "notepad++.exe" /f

assoc .txt=MyCustomType
ftype MyCustomType="C:\Program Files\Noteepad++\notepad++.exe" "%1"

(it's better to put them in .bat file)

T.Todua

Posted 2009-08-25T22:56:17.780

Reputation: 2 436

0

To sum up the above said and having corrected some escape issues in .BAT file (NOT IN CMD) it should look like this:

REG ADD "HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command" /v @ /t REG_SZ /d "\"D:\\Public\\englishextra\\Notepad++Portable\\notepad++.exe\" \"%%1\"" /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\jsfile\DefaultIcon" /t REG_SZ /d "D:\Public\englishextra\Notepad++Portable\notepad++.exe,0" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.js" /v "Application" /t REG_SZ /d "notepad++.exe" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.js\OpenWithList" /v "g" /t REG_SZ /d "notepad++.exe" /f

assoc .js=jsfile
ftype jsfile=D:\Public\englishextra\Notepad++Portable\notepad++.exe %%1

shimanskybiz

Posted 2009-08-25T22:56:17.780

Reputation: 11

1(1) We frown on answers that merely summarize other answers. We do allow answers that build on previous answers, but you must identify the answer(s) that you are building on (by author’s name and link; not “the above”) and state the improvement you are making.  (2) What do you mean by “in .BAT file (NOT IN CMD)”?  (3) Every other example of an ftype command has %1 (or %%1) in quotes. Yours does not. Do you claim that your command is better because it leaves out the quotes? That would be rare.  Please do not respond in comments; [edit] your answer to make it clearer and more complete. – Scott – 2018-10-09T16:47:08.770

0

I didn't think people used .bat any more, switched to .cmd a while ago. Anyway, we are trying to restore default to Adobe Reader for PDFs after installing Acrobat.

Doing exactly what the last guy did and it still doesn't change. I don't know if anyone can see where I made a mistake or just are seeing the same thing, and yes I know how to change it in the GUI, but this is for a mass deployment so keep that to yourselves-

REG ADD "HKEY_CLASSES_ROOT\Applications\AcroRD32.exe\shell\Read\command" /v @ /t REG_SZ /d "\"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe\" \"%1\"" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf" /v "Application" /t REG_SZ /d "AcroRd32.exe" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithList" /v "g" /t REG_SZ /d "AcroRd32.exe" /f

ftype "PDF File"="C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" "%1"
assoc .pdf="PDF File"

Jeffrey Peters

Posted 2009-08-25T22:56:17.780

Reputation: 1

1If you run these commands from CMD, then use %1, but if you run .bat file, then use %%1 – T.Todua – 2015-06-14T19:38:52.240