SoFunction
Updated on 2025-04-08

Windows file type and open method definition method

assoc: defines file type according to file extension. You can use this command to display or modify file extension associations
For example:
.bat=batfile
.xls=.8

ftype: Define the opening method according to the file type. This command can be used to display or modify the file type used in the file extension association.
For example:
batfile="%1" %*
.8="C:\Program Files\Microsoft Office\Office\" /e

illustrate:
The basic usage format of Ftype is: Ftype [File type [=[Open method/Program]
For example: Like the ftype exefile= %1 in the above example, it means that all files with file type EXE (exefile is represented as EXE type file) are opened through the "Notepad" program, and the subsequent %1 represents the program to be opened (that is the program when double-clicked).
ftype exefile=%1 %* means that all EXE files can be run directly (EXE can be run directly, so use %1 of the program itself), and the %* afterwards means all parameters brought by the program command (this is why EXE files can be run with parameters).

Therefore, if you find any problem with the system file type and association, we can use these two commands to reset it directly.