ftype

set file type association 

Command


SYNOPSIS

ftype [-a] [filetype]

ftype [-c assoc_cmd] [filetype [value]]


DESCRIPTION

The ftype command sets up an association between a file type name, and a string to be used to execute it. File type names are created using the assoc command.

With no arguments, all file associations are displayed in two tab-delimited columns. The first column is the file type name, and the second is the string that is executed when that file type is executed.

With one argument, the single file association (for Open) for the file type given is displayed.

With two arguments, a new file association is created, or a current one is replaced.

The syntax of the command to execute is defined by the Explorer. %1 is replaced by the short name of the file being executed; %L is replaced by the long name; and %* is replaced by the name of any arguments to the file.

Note:

Be careful when using %L. Eventually, any quotation marks in the value of %L are stripped off and the argument passed to the command may contain file names with spaces. Such file names can cause problems with some commands. If this is a concern, you should use %1 instead of %L.

Options

-a 

displays all associations for the specified file type, not just those for Open. Instead of the usual two column display, this option produces a three column tab-delimited display of the form:

<file type>	<association command>	<command string>
-c assoc_cmd 

displays or sets the file association for the specified association command (assoc_cmd). For example -c Edit displays are the associations for Edit.

You cannot specify both the -a and -c options because they are contradictory. The -a option deals with all file associations for a file type while the -c option works with one specific association command.


EXAMPLES

The following example first uses assoc to associate the .ksh file name extension with the mks_shell file type, and then uses ftype to set the command to be run for that file type.

assoc .ksh mks_shell
ftype mks_shell "wstart -Nm sh.exe -H --\"%L\" %*"

The following command displays the editing association for the mks_shell file type:

ftype -c Edit mks_shell

while the following command sets up a new editing association for that file type:

ftype -c Edit mks_shell "viw %1"

DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


NOTES

ftype and assoc are named after similar commands built into cmd.exe.

This command is actually implemented as a shell script, changing the appropriate registry entries using the registry command. MKS cannot be responsible for proper functionality of this code if you alter the ftype.ksh file in any way.


PORTABILITY

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
assoc, registry


PTC MKS Toolkit 10.4 Documentation Build 39.