Display or change the link between a FileType and an executable program
Syntax FTYPE fileType=executable_path
FTYPE FTYPE fileType FTYPE fileType= Key fileType : The type of file executable_path : The executable program including any command line parameters
More than one file extension can be associated with the same
e.g. both the extension .JPG and the extension .JPEG can be associated with the File Type "jpegfile"
File Types can be displayed in the Windows Explorer GUI under Options, File Types however the naming used is not consistent e.g. the File Type "txtfile" is displayed in the GUI as "Text Document"and "jpegfile" is displayed as "image/jpeg"
Several FileTypes can be linked to the same executable application.
FTYPE filetype will display the current executable program for that file type e.g. FTYPE jpegfile.
FTYPE without any parameters will display all FileTypes and the executable program for each.
It is almost always necessary to supply command line parameters so that when a document is opened not only is the relevant application loaded into memory but the document itself also loaded into the application. To make this happen the filename of the document must be passed back to the application.
Command line parameters are exactly like batch file parameters, %0 is the executable program and %1 will reference the document filename
so a simple command line might be:
If any further parameters are required by the application they can be passed as %2, %3. To pass ALL parameters to an application use %*. To pass all the remaining parameters starting with the nth parameter, use %~n where n is between 2 and 9.
The FileType should always be created before making a File Association
FTYPE htmlfile="C:\PROGRA~1\Plus!\MICROS~1\iexplore.exe" -nohome
FTYPE pagemill.html=C:\PROGRA~1\Adobe\PAGEMI~1.0\PageMill.exe "%1"
FTYPE rtffile="C:\Program Files\Windows NT\Accessories\WORDPAD.EXE" "%1"
FTYPE word.rtf.8="C:\Program Files\Microsoft Office\Office\winword.exe" /n
If you have multiple applications that use the same file extension, the ASSOC command can be used to switch the file extension between the different FileTypes.
Specify executable_path=nothing and the FTYPE command will delete the executable_path for that FileType.
FOR /F "tokens=* delims=" %G IN (backup_types.txt) DO FTYPE %G
FOR /F "tokens=* delims=" %G IN (backup_ext.txt) DO ASSOC %G
This will recreate the CLASS id's in the registry at HKey_Classes_Root\.<file extension>
If you put the commands above in a batch file change the %G to be %%G
If you have a file association between .DOC and Word for Windows then at a command prompt you can open a document with any of the following commands:
Start "My Document.doc"
note that the file extension must be supplied for this to work
When CMD Command Extensions are enabled (the default)
If the File Type Association was successfully changed %ERRORLEVEL% = 0
If File Type Association could not be changed = 1
FTYPE is an internal command.
"True to type - Of a plant, or group of plants, which matches the accepted description of the cultivar to which it is assumed to belong"
ASSOC - Change file extension associations
Batch file to list the application associated with a file extension
ASSOCIAT - One step file association (Resource Kit)