Would you like to learn how to configure file association on Windows using the command line? In this tutorial, we are going to show you how to associate a file extension to a specific program.

• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10
• Windows 7

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Windows Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Windows.

Tutorial Windows - Create a new file association using the command-line

As an Administrator, start an elevated command-line.

Windows - Elevated command prompt

Associate a file extension with a file type.

Copy to Clipboard

Verify the file extension association.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, we associated the file extension TC1 with the file type named TC1FILE.

Create a new file type.

Associate a command to open this file type.

Copy to Clipboard

Verify the command associated with the file type.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, the file type named TC1FILE was associated with the notepad application.

Create a file using the extension TC1.

Copy to Clipboard

Double-click the file with the new extension.

Windows - File type association

The Notepad application will automatically open the new file extension.

Windows - Extension type association

In our example, we associated a file extension with a file type.

In our example, we associated a file type with a command.

Congratulations! You are able to configure file association using the command-line on Windows.

Tutorial Windows - Configure a file association using the command-line

As an Administrator, start an elevated command-line.

Windows - Elevated command prompt

Verify the file type associated with a file extension.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, the TXT extension is associated with the file type named TXTFILE.

Configure this file type to be associated with another program.

Copy to Clipboard

Verify the command associated with the file type.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

In our example, the file type named TXTFILE was associated with the WORDPAD application.

Congratulations! You are able to configure file association using the command-line on Windows.