Home > Commands A-M > Commands F

FTYPE


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Display or change the link between a fileType and an executable program.

The FileType should always be created before making a File Association.


Syntax

FTYPE /?

FTYPE [filetype]=[executable_path]

Display all FileTypes and the executable program for each:

FTYPE

Display the current executable program for that file type:

FTYPE filetype

Delete a file type:

FTYPE filetype=


Parameters
filetype (NT4)
The type of file.
More than one file extension may be associated with the same File Type. e.g. both the extension .JPG and the extension .JPEG may be associated with the File Type "jpegfile".
File Types can be displayed in the Windows Explorer GUI: [View, Options, File Types] however the spelling is usually different to that expected by the FTYPE command 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, but one FileType cannot be linked to more than one executable application.
executable_path (NT4)
The executable program including any command-line parameters.
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:
MyApplication.exe "%1"
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.

Switches
/? (NTXP)
Display help.

Related

ASSOC - Change file extension associations.
ASSOCIATE - One step file association.


Notes

Switching a File Association between multiple applications

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.

Backing up your FileTypes:

    FTYPE >backup_types.txt
    ASSOC >backup_ext.txt

Restoring your FileTypes from a Backup:

    FOR /F "tokens=* delims=" %G IN (backup_types.txt) DO FTYPE %G
    FOR /F "tokens=* delims=" %G IN (backup_ext.txt) DO ASSOC %G

Note that unlike simply backing up the registry, this method will actually recreate all the CLASS id's. If you put the commands above in a batch file change the %G to be %%G.


Examples
    FTYPE htmlfile="C:\PROGRA~1\Plus!\MICROS~1\iexplore.exe" -nohome
    ASSOC .html=htmlfile
    FTYPE pagemill.html=C:\PROGRA~1\Adobe\PAGEMI~1.0\PageMill.exe "%1"
    ASSOC .html=pagemill.html
    FTYPE rtffile="C:\Program Files\Windows NT\Accessories\WORDPAD.EXE" "%1"
    ASSOC .rtf=rtffile
    FTYPE word.rtf.8="C:\Program Files\Microsoft Office\Office\winword.exe" /n
    ASSOC .rtf=word.rtf.8

Errorlevels

none.


Availability
Internal
DOS
none
Windows
none
Windows NT
NT4 NT2000 NTXP NT2003