Windows: Change application for a file extension from command line

Hi,

Windows has two command line utilities to alter the application associated with a file extension.

First of all deterine the installed application. ftype gets the whole list of programs registered in HKEY_CLASSES_ROOT.
The HKEY_CLASSES_ROOT tree is a view combined by merging HKEY_CURRENT_USER\Software\Classes and HKEY_LOCAL_MACHINE\Software\Classes.

D:\> ftype

For example you want to change the file extension .pdf to the Acrobat Reader.

assoc list the current appication associated with .pdf

D:\> assoc .pdf

Then determine the application name

D:\> ftype | findstr /i acrobat
acrobat="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" / u "%1"
AcroExch.acrobatsecuritysettings.1="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" "%1"
AcroExch.Document.2017="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" "%1"
AcroExch.FDFDoc="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" "%1"
AcroExch.pdfxml.1="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" "%1"
AcroExch.XDPDoc="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" "%1"
AcroExch.XFDFDoc="C:\Program Files (x86)\Adobe\Acrobat Reader 2017\Reader\AcroRd32.exe" "%1"

and link the .pdf extension to.

D:\> assoc .pdf=AcroExch.Document.2017

Michael

Leave a Reply Cancel reply