How to see the contents off a cfg file?

extension

I have some questions about the .cfg file format.

How can I open it and how can I edit the file so that it is still usable?

If I search on the internet for a .cfg file editor I didn't find anything usable.
I tried to edit it in Notepad or Wordpad it becomes unusable and if I use Free File Viewer I only can read it, but not editing.

Does anyone knows a good editor, so that the file is still usable after editing?

Best Answer

This is probably a question for another forum than Serverfault, but simply put: .cfg is not a single well-defined file format, though you can usually assume it's a plaintext configuration file with human-readable contents.

From your question I assume it's a file for a Windows-based software. In that case Notepad is the easiest built-in way not to introduce problems. Just remember the following:

  1. Notepad by default adds a .txt extension to file names. You need to Save as... and switch the Save as type field to All files (*.*)in the save dialog before storing the file with a .cfg suffix.

  2. Windows by default hides file suffixes, so unless you take the previous step, files will look as though they have a .cfg suffix in the File Explorer/Computer view, but will in fact have a hidden .txt suffix and not be read by the software.

I suspect these two points explain why you couldn't get a (presumably correctly formatted) config file to work with your program.

Once you've outgrown Notepad, there's a bunch of editors to choose from:

  • Notepad++ (as mentioned by @Norbert Weuster) is a nice pretty lightweight tool.
  • Many programmers like to use the Sublime text editor, which can be used in a free mode but becomes a lot more powerful if you pay for it.
  • If you can live with Electron apps (as opposed to native ones), Visual Studio Code is a pretty decent-looking "free" text editor.
Related Topic