IPCONFIG – Release, Renew, FlushDns & More (Windows Command Line, CMD, DOS)
The ipconfig command is extremely useful let alone necessary, not only for system administrators but also for the majority of power users.
Welcome!
This short guide is all about extension associations and file types.
Lets get started!
Windows associates every extension with a certain file type so that it knows the type of data contained within that file, and thus how to execute or open it.
For example, windows by referencing the extension association of a .png file knows that it’s an image and opens it with the appropriate application.
File types are names that windows gives to every file of a certain type, for example text files use the txtfile file type.
One file type can also be associated with many extensions. For example, both .7z and .zip extensions are associated with the 7-Zip file type.
On the other hand, an extension can only be associated with one file type.
Open your command line and use the assoc command without any parameters to view every extension as well as its file type association.
Assoc
Every extension and file type in your system will immediately show up.
Note the names of the file types that appear, are a bit different than what they are on the GUI.
That’s because windows displays the file type names that are more easily understood to its users rather than those that it uses internally. For example, what you usually see as “Text Document” appears as “txtfile”.
You can view how the name of a file type is usually displayed us simply by typing its name after the assoc command.
Assoc txtfile
And as you can see the “txtfile” file type is displayed as “text document”.
Using the assoc command we can view and change the file type association of a specific extension simply by typing the assoc command followed by the name of an extension.
Assoc .txt
The file type of the .txt extension will immediately show up.
By changing the extension association of a file type, we can determine which application should be used to open it.
For example, lets make every file with a .txt extension open with Microsoft Word.
First, we must find out what file type word documents use. To do so let’s view the association of an existing extension that opens Microsoft word, such as .docx.
Assoc .docx
Let’s verify that this is our file type, by typing its name after the assoc command.
Assoc Word.Document.12
And as you can see this file type indeed opens Microsoft Word documents. As expected.
Now that we know what file type to use let’s associate it with the .txt extension.
To change the file type of an extension simply type the assoc command followed by your extension and make it equal to the file type of your choice.
Assoc .txt=Word.Document.12
Windows will now treat .txt files as word documents and open them with Microsoft word.
If you get an “Access is denied error” You need to run the command in a command prompt with administrator privileges.
Note that you cannot assign any association to any file type. That’s because the application of your choice might not know how to handle the data contained within your file.
For example, if you were to make every .rar file open as a text document, your text editor would not have been able to read and understand your file.
That’s why its important that are incredibly careful when changing extension associations, the wrong command can easily make files of a certain extension or file type unopenable.
Finally, you can associate a file type to only extensions that do not have any existing associations. For example, to make windows open every file with an unrecognized extension as a text document type the following:
ASSOC .=txtfile
Any file that has an unrecognized extension will now be opened as a text document.
Display every association between the file types and extensions in your computer.
Assoc
Display the extension association of the txtfile file type.
Assoc txtfile
Display the file type associated with the .txt extension.
Assoc .txt
Associate every .txt extension with the word document file type. This will make every text file open with Microsoft word.
Assoc .txt=Word.Document.12
Associate every extension that does not have any association with the txtfile file type. This will make every unrecognized extension in your computer open as a text file.
Assoc .=txtfile
Displays or modifies file extension associations
ASSOC [.ext[=[fileType]]]
.ext Specifies the file extension to associate the file type with fileType Specifies the file type to associate with the file extension
Type ASSOC without parameters to display the current file associations.
If ASSOC is invoked with just a file extension, it displays the current file association for that file extension.
Specify nothing for the file type and the command will delete the association for the file extension.
You now know what file extension associations and file types are and how you can use them.
If you liked this short guide take a look at a few of our other posts related to the windows command line, or if you really liked it consider enrolling in our video course where you will learn the ins and outs of the Windows command Line.
This course has everything you need to start learning about the windows command line along with batch scripting.
The ipconfig command is extremely useful let alone necessary, not only for system administrators but also for the majority of power users.
A redirector or pipe is a special symbol that is used to redirect the input or output of a command or combine two or more commands in various ways.
This guide is all about various cmd commands you can use to manage and troubleshoot networks directly from the windows command line.
Learn the Windows command line And Become an Expert!