The command: "FTYPE" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available
The examples for the command "FTYPE"
The
`FTYPE` command in the Windows Command Prompt is used to set file type associations for specific file extensions. Here are some examples:
Example 1: View current file type associations:
FTYPE
Description: This command displays all current file type associations. A list of file extensions and their associated executors are displayed.
Example 2: Show file type association for a specific extension:
FTYPE .txt
Description: Displays the current file type association for the
".txt" file extension. You will see which execution program this extension is assigned to.
Example 3: Change file type association for an extension:
FTYPE .txt=notepad.exe
Description: Changes the association for the file extension
".txt" and assigns the program
"notepad.exe" to it. This will open the text document with Notepad.
Example 4: Delete file type association for an extension:
FTYPE .txt=
Description: Deletes the association for the file extension
".txt". Windows will no longer attempt to automatically open a specific application with files of this extension.
Example 5: Add file type association for an extension:
FTYPE .xyz=MyApplication.exe
Description: Adds a new association for the file extension
".xyz" and assigns the executable program
"MyApp.exe" to it.
Example 6: Save all file type associations to a text file:
FTYPE > File type associations.txt
Description: Saves all current file type associations to a text file named
"filetype associations.txt". The file contains information about which file types certain file extensions are assigned to.
It's important to note that changing file type associations affects the way Windows opens files. It should be done with caution and it is advisable to know the default mappings before making any changes. The examples above are simplified and are intended to show basic usage of
`FTYPE`. It is always a good idea to consult the full help with
`FTYPE/?` to see all available options and details.
"FTYPE" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
C:\\WINDOWS>
Displays or modifies file types used in file extension associations
FTYPE [fileType[=[openCommandString]]]
fileType Specifies the file type to examine or change
openCommandString Specifies the open command to use when launching files
of this type.
Type FTYPE without parameters to display the current file types that
have open command strings defined. FTYPE is invoked with just a file
type, it displays the current open command string for that file type.
Specify nothing for the open command string and the FTYPE command will
delete the open command string for the file type. Within an open
command string %0 or %1 are substituted with the file name being
launched through the assocation. %* gets all the parameters and %2
gets the 1st parameter, %3 the second, etc. %~n gets all the remaining
parameters starting with the nth parameter, where n may be between 2 and 9,
inclusive. For example:
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
would allow you to invoke a Perl script as follows:
script.pl 1 2 3
If you want to eliminate the need to type the extensions, then do the
following:
set PATHEXT=.pl;%PATHEXT%
and the script could be invoked as follows:
script 1 2 3
Important information, tips for the "FTYPE" command
There are a few important points to note when using the
`FTYPE` command in the Windows Command Prompt:
1.
File Association Effects: The
`FTYPE` command changes the association between file types and the corresponding programs used to open those file types. Adding, changing, or deleting associations can cause files to open in unexpected ways.
2.
Permissions: Changing file type associations requires administrative privileges. Make sure you run Command Prompt as an administrator.
3.
Syntax in Batch Files: If you want to use the
`FTYPE` command in a batch file, you need to replace the
`%` character with
`%%`. For example:
`FTYPE .txt=notepad.exe` becomes
`FTYPE .txt=notepad.exe` in a batch file.
4.
Careful Syntax: Pay attention to the correct syntax for adding, changing, or deleting file type associations. Incorrect syntax can cause errors or change mappings unexpectedly.
FTYPE .txt=notepad.exe (Correct)
FTYPE .txt notepad.exe (False)
5.
Specify correct program: Make sure you provide the full path to the executing program or that the program is included in the system paths.
FTYPE .txt=C:\path\to\your\program.exe
6.
Check existing mappings: Before adding a new mapping or modifying an existing one, review the current mappings to ensure you are not making any unwanted changes.
FTYPE
7.
Restore Defaults: If you have made changes and are having problems, you can try restoring the defaults. Please note that this will reset the original settings.
FTYPE exefile="%1" %*
8.
Registry Editor: In Windows, file type associations are also stored in the registry. You can use the registry editor (
`regedit`) to make detailed changes. Please note, however, that registry changes should be made carefully.
9.
Restart required: In some cases, changes to file type associations will not take effect until the system is restarted.
10.
Use with caution: Adding or changing file type associations should be done with caution as this may result in files becoming unable to open properly or being opened by an unwanted program.
It is always advisable to back up and be sure of the impact of the changes before using
`FTYPE`. Also note that many users rarely need these commands because most file associations can be controlled through the graphical user interface file association system in Windows.