Using ASSOC Command to Modify File Extension

Here is how you can use ASSOC Command to Modify a File Extension

A file system is a core part of every operating system today. While most modern file systems come equipped with basic features like copying or moving files, storing file sizes, supporting mounting drives, etc. there are still some fundamental differences in the functioning of each file system.

For example, Windows specifies a file’s type based on its extension alone. If it’s an .exe file then Windows will try to execute it when the file is opened while a .txt file will be opened as a text file. However, in Linux, the extension of a file holds no value and a file can be specified as executable using a bit in the file’s permissions.

As such, the extension of a file holds a lot of importance in Windows. It is really important to know the extensions of basic file types. There are hundreds of different kinds of extensions in Windows today. An extension alone holds no value other than signifying a file’s type to the operating system or the user – it is only a part of the file’s name and anyone can make their own extensions. However, we would recommend using already existing extensions to make it easy for the user to open the file using any commonly-available software.

Different file extensions are associated with different file types in Windows. The Windows ASSOC command is a useful utility to let you see all the listed file types and their extensions.

Using ASSOC to list file extensions

  1. Open the Windows Command Prompt by searching for cmd from the Start menu.
  2. Type assoc, as shown in the screenshot below, to list all the files and their extensions,

It will list down all the extensions and their respective file types.

To see a particular filetype, you can type the following command,

assoc .<ext>

For example,

assoc .txt

It will show you the filetype associated with that particular extension. You can also set an extension for any extension you want to create. For example, if you want to create an extension called .nxt and want it to be treated as a Text File and be editable through text editors, here is how you can go about it,

Note: You will need to have administrator access for this and run the Command Prompt in an elevated mode. You can use our guide over here to do this.

assoc .nxt=txtfile

That is it. Now if you create any file with the .nxt extension, Windows will list the file type as a Text Document.