Similar to the way you can add command variables to the Steam Launch Options, you can also add them to the Half Life 2 startup by editing the desktop icon used to launch the game. You can now enter command variables in this box and they will be executed whenever you start Half Life 2 from Steam or your desktop icon. In the Properties box which opens, click the 'Launch Options' button. Right-click on the Half Life 2 entry under 'My Games' and select Properties. To do this, right-click on your Steam icon and select 'Play Games'. You can add various command variables into the launch options for Half Life 2, ensuring that they are activated each time Half Life 2 is launched. They will not run automatically at startup however - only autoexec.cfg and config.cfg can do that. For example typing the command: exec mytweaks.cfg in the console will execute the command variables contained in the mytweaks.cfg file. cfg), such as mytweaks.cfg, place them in the same directory as config.cfg, and then run the commands they contain from the Half Life 2 console (or from autoexec.cfg) by using the "exec" command. cfg files you need, name them as you wish (as long as they end in. By default the Half Life 2 engine looks for autoexec.cfg at startup, and if it finds it, it will automatically load and execute all the valid commands in it along with those in config.cfg while starting up Half Life 2.Īdditionally, you can create any other. Rename this new text document to autoexec.cfg (not ), and you can now insert all your custom commands into this config file. To do this, in the same directory as config.cfg, right-click in an empty area and select New>Text Document. While you can add, edit and remove commands directly in config.cfg, it is recommended that instead you create an entirely new file for adding custom commands. The config.cfg file is very important, so you should first create a backup of it before you edit it in any way.
#Hl2 how to make an autoexec windows#
This file can be opened and edited using any text editor, such as the Windows Wordpad. Half Life 2 holds many of the settings you select in the in-game options - along with a range of other custom variables - in a file called config.cfg, which can be found in your \Program Files\Valve\Steam\SteamApps\\half-life 2\hl2\cfg\ directory. It allows you to see a range of information about the game and you can use it to change the way the engine behaves. The Half Life 2 Console is a window into the game's Source engine. Now you can open and close the console at any time by pressing the '~' key (the key under ESC). To enable the Half Life 2 console, you will first need to go into the in-game options, and under the Keyboard tab, click the Advanced button and tick the 'Enable developer mode (console)' option (see the Keyboard option under the In-Game Settings section above). Make sure you read through this information carefully otherwise the tweaks in the Advanced Tweaking section will not function correctly if at all: The way to access and use each method is covered below. This is no coincidence - although Half Life 2 has a completely different engine from Doom 3, it is the sign of an advanced and highly modifiable engine that you can access a large range of command variables in a variety of ways. There are a lot of similarities between tweaking Doom 3 and Half Life 2. If this section looks familiar to you, that's because you may have seen something just like it in my Doom 3 Tweak Guide. These various methods usually result in the same outcome for each command, however they provide flexibility in the ways in which you can test, add, edit and remove cvars for the game.
![hl2 how to make an autoexec hl2 how to make an autoexec](https://media.moddb.com/images/mods/1/34/33075/Logo3.png)
There are four main ways in which you can implement command variables in Half Life 2: In the game's Console through Config (.cfg) files in the Steam Launch Options box or in your game icon's Target box.
![hl2 how to make an autoexec hl2 how to make an autoexec](https://i.ytimg.com/vi/yRNduLzE08A/mqdefault.jpg)
This section provides details of how to tweak Half Life 2 correctly using the command variables, and the next few pages provide a list of the more useful command variables and what they do. This gives us an excellent opportunity to tweak Half Life 2 to its fullest potential. The Source Engine by Valve is highly customizable: there are over 1800 Command Variables (cvars) which can be used to alter everything from the way the game allocates memory to providing additional game information to recording demos and running custom benchmarks. You can change more than just the handful of settings available under the in-game options in Half Life 2.