.cfg Files
Contents
Overview
A config file is a file that stores commands for your game. In Portal 2, the game has many config files that it keeps track of for a variety of different purposes. As users, we can create config files that contain any commands we want.
Execution
The execution order for config files in Portal 2 goes as follows
- The autoexec.cfg is ran at startup, and is the first config file loaded.
- The config.cfg file is ran after, and loads in all of your saved binds and settings that carry over.
This means that the Autoexec is not a good place to put binds. They will be overwritten by your config.cfg file after the game loads. If you intend on setting up custom binds, enter them manually in console, or in an exec that is run separately.
Executing a .cfg file
To exec a .cfg file, it must be located in Portal 2's installation folder (usually C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2\cfg
)
The file named autoexec.cfg
will exec on game launch, any other exec you make will need to be manually executed as such in the Portal 2 console.:
exec filename
You do not need to include the .cfg extension when executing
Useful Tools
Filtering Out Junk Text
There are a few error messages or warning in the Source Engine that aren't useful, and will constantly fill up your console with garbage text, the command con_filter_enable 1 allows you to filter out specific strings from appearing in your console.
A common use of this filter is for CShader warning messages that fill your console with constant messages. Filtering it in your autoexec is simple. In the example below, any line with the text CShader
is filtered out, but you can replace this with any string.
con_filter_enable 1
con_filter_text_out "CShader"