Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

6 Answers 6

up vote 9 down vote accepted

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

share|improve this answer
    
Creative Element Power Tools has been discontinued and is no longer supported. Instead use FileTypesMan –  crazypotato Aug 8 at 23:16

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.

share|improve this answer
    
thanks. I just tried with "assoc .=MyCustomType" for files with no extension, and it worked! –  gulbrandr Nov 21 '10 at 19:43
    
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 Jul 6 at 15:07

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
share|improve this answer
    
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 Jul 16 at 16:40

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)

share|improve this answer

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.

share|improve this answer

i didnt think people used .bat any more, switched to .cmd a while ago... any way we are trying to restore default to adobe reader for pdfs after installing acrobat (not sure why they want to but whatever)

doing exactly what the last guy did and it still don change don't kno wif any one 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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.