I was checking out the files in a old game called Warcraft III and saw that they had files with their own extension, for example, file name.w3x.

How do you make your own file extension and run it?

5 Answers 5


In short: you make your own file extension by applying whatever letters you want to the end of the file name. You run it by telling your OS what program should be called when you double-click on it.

Full explanation:

A file extension is actually just the letters after the file, there is nothing magical about the extension. A lot of files I have made when I'm on my Linux machines I have forgotten to even put the file extension on.

That being said, in Windows the file extension is how Windows determines what the file is. If you change the file extension of a .mp3 for example to a .png Windows will think it is a picture when it tries to open it. What Windows does is it looks at the extension and sends the file to an appropriate program related to that file. so .mp3 gets sent to iTunes, .png gets sent to Paint, .html gets sent to Firefox/Chrome, and .docx gets sent to Word.

In terms of the creation of these files, they fall into two categories. There are plain text files (.html, .txt, .java, .py, .cpp, .config, .xml) and then there are binary data files (.exe, .mp3, .png) (well, and then there are mixes of binary and plain text like .docx, but they can be treated like binary files). When you are dealing with plain text files (it is plain text if Notepad can open it) it is very easy to do. Depending on your programming language you basically just open a file and read/write strings to the file. With binary files, it gets a little more complicated, but the principle remains the same, you are reading/writing bytes from a file.

To make a file of a particular type executable (by double-clicking on it) is probably the hardest step depending on your programming language. If it is C or C++, you simply point Windows to your .exe and Windows sends the file you wish to open as the second argument in args to your program's main method. In Java or Python, it is still doable, but you'll have to work out some sort of workaround to get Windows to open the run-time environment or interpreter and send the file argument to the program.

  • What about creating a custom file type (like .myfile)? How do you tell the OS that the app you made was supposed to open it? As opposed to some other text editor...
    – theX
    Aug 18, 2020 at 16:37
  • simple and beautiful
    – Alex M.M.
    Dec 11, 2020 at 9:35
  • 2
    @theX it can be done with the assoc and ftype commands in cmd
    – phuclv
    Mar 31, 2021 at 15:04

You will need to choose a programming language, then write a program which looks for files with the extension you have chosen. Those files must also be written in a way that the program looking for them can read, understand and execute the code within.


Assuming since you're talking about Warcraft III you're on Windows. Also assuming you're not wanting to do this programatically (otherwise you would have asked on stackoverflow).

Save a file with your custom extension. Open the file in Windows Explorer and it will ask you how to open it. Choose "pick from list", select the program you want, and check "Always use the selected program to open this kind of file". Voila, you can now "run" files with your custom extension.


The .w3x extension is a map extension. Warcraft 3 doesn't run this extension, it's just map data.

They have their own algorithm / markup language to create these files and how to read them.


Well, just save the file under some name and that extension. "Running" it is a little more difficult, and depends partially on the OS as well.

  • He just has to run it with the program he used before....
    – rassa45
    Aug 1, 2015 at 7:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .