Using the ftype command (with examples)
- Windows
- November 5, 2023
1: Display a list of all file types
Code:
ftype
Motivation: When working with file extensions and associations in Windows, it can be useful to have a comprehensive list of all file types currently registered on the system. This can help identify conflicts or determine the default programs associated with each file type.
Explanation: The ftype
command without any arguments simply displays a list of all file types along with their associated commands or programs. This list includes both the system-defined file types and any custom file types that have been registered.
Example output:
.txt=txtfile
.jpg=jpegfile
.doc=Word.Document.8
...
2: Display the associated program for a specific file type
Code:
ftype file_type
Motivation: Sometimes you may need to know the default program associated with a specific file type. This can be useful when troubleshooting issues or when you want to change the default program for a particular file type.
Explanation: By specifying the desired file type after the ftype
command, you can retrieve information about the associated program. The file_type
argument should be the file extension without the dot (e.g., “txt” instead of “.txt”).
Example output:
ftype txtfile
txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
3: Set the associated program for a specific file type
Code:
ftype file_type="path/to/executable_file"
Motivation: Occasionally, you may want to change the default program for a specific file type to a different executable file. This can be useful when you prefer to open a certain file type with a specific program or when you’ve installed a new program that can handle that file type more effectively.
Explanation: To set the associated program for a specific file type, use the ftype
command along with the file type and the path to the desired executable file enclosed in double quotes. The file_type
argument should be the file extension without the dot (e.g., “txt” instead of “.txt”).
Example:
ftype txtfile="C:\Program Files\MyTextEditor\texteditor.exe"
Note: Make sure to provide the correct path to the executable file.