exec
To execute script files directly from CS:GO and CS2, like the CS GO exec file, you’ll need to utilize the exec command. Specifically designed for running script files located inside the cfg folder, this command allows you to execute any sequence of commands multiple times, provided they are stored in a .cfg file.
On this page, you are going to learn what the exec command is, how it works, how to use it and you can also check real examples on how it’s implemented in CS:GO and CS2.
Syntax of the exec Command
The command is “exec” and you need to input it via console using the name of a script file as the argument. It’s important to note you don’t have to include the extension of the file name.
Therefore, it is easy and practical to execute this command, as its syntax rules are clear and straightforward. All you need to do is to input “exec” along with the name of the .cfg file you want to execute and it will work instantly.
For instance, if you type “exec superplayerconfig” and press Enter, the script file superplayerconfig.cfg will be executed as intended, all without having to include the .cfg extension in the argument.
Default Value of the Command
The command doesn’t have a default value because it won’t change the mechanics of the games or alter any settings directly, as it’s only been designed to execute .cfg files directly from the console.
Unlike other commands that might toggle on or off certain features, or alter the normal values of the game such as the maximum speed for players or moving objects/entities, exec’s only use is to execute script files.
Therefore, using it a cvar client won’t work, because as we have previously mentioned, it needs a valid .cfg file name as the argument in order to execute.
Purpose of the exec Command
The purpose of the exec command is straightforward: you can use it to execute script files directly via the developer console. Valve added this command to CS:GO, CS2 and all Source games to make it easier for players to execute the necessary script files quickly.
For example, if you have added a list of several commands you want to apply at once, you can use the exec command to execute the autoexec.cfg file directly from the console, and it’d automatically apply all the changes and adjustments.
Thanks to this command, players can save plenty of time, especially if they need to execute a sequence of commands several times, as you can just put them in a .cfg file and execute them directly from the console.
Basically, you can create all the script files you want, targeting specific commands and functions, and simply use the exec command to execute them whenever you wish to. Just make sure all the script files are located in the cfg folder, so you can execute them instantly and without problems.
Requirements to Use the exec Command
In order to execute the exec command, you need to meet the following requirements:
- All the script files must be located in the cfg folder
- You must use the name of the script file as the argument
- The name you use as the argument must match an existing .cfg file in the corresponding folder
You can execute this command without activating sv_cheats or the developer command. Simply input it as instructed, following its syntax rules, and it will work without problems.
If you’ve never made a script file before, it’s quite simple. Just gather the sequence of commands you want to use, put them into a text file, and then change its extension to .cfg. Afterward, you’ll need to place it in the appropriate folder, which you can find at: \Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg.
Certainly, this process will only succeed if your script file contains valid commands that adhere to their respective syntax rules. Hence, it’s advisable to double-check your file to ensure flawless execution when activating it with the exec command.
Feel free to explore our dedicated section on all CS:GO and CS2 commands. Here, you can learn how to utilize them effectively, enabling you to configure your script files flawlessly for execution using the exec command.
Available in CS:GO and CS2
The exec command is available in CS:GO and CS2, because it’s part of all the existing Source games. For example, if you had a .cfg file you used in CS:GO, you can use it for CS2 as well as execute it instantly by using the exec command.
However, we recommend you to double check if the commands you used for CS:GO are still valid in CS2. This is why we encourage you to explore our dedicated section on all CS:GO and CS2 commands, to make sure you can execute your script files without problems by using the exec command.
Now that you know all about the exec command, let’s check below how you use it via the developer console.
How to Use the exec Command
Here is how you can use the exec command via console to execute any script file, by simply following 5 easy steps:
- Press the “~” key to launch the console
- Decide what script file you want to run
- Input exec “X”
- Hit Enter
- The command will execute the corresponding .cfg file instantly
All you need to do is to replace “X” for the name of the file. For example, if you want to execute the favcommands.cfg file, it would result in the following command: exec favcommands. Simply press Enter and it’d execute all the commands found in the favcommands.cfg file.
The most popular way to store a sequence of commands is in the autoexec.cfg file, and if you wanted to run it, you’d need to use “autoexec” as the argument of the command, resulting in the following: exec autoexec.
If you want to explore more ways on how to use this command, below you will find a list of examples on how to implement the exec command.
Examples on How to Use the exec Command
Here are eight examples demonstrating how you can utilize the exec command effectively. By understanding these examples, you’ll grasp how to implement it in the game to execute any script files you desire.
Execute the autoexec.cfg File
If you have stored several commands in the autoexec.cfg file, and you want to execute them all automatically, you need to use the name of the file – autoexec – as the argument, resulting in the following: exec autoexec. Input it, press Enter and it will execute the full sequence of commands immediately.
Execute the warmup.cfg File
If you have created a script file to run specific commands during the warmup, and you want to execute it now directly via the console, you need to use the name of the file as an argument – warmup – resulting in the following: exec warmup. Input it via console, press Enter and it will execute the file automatically.
Execute the server.cfg File
If you have created a script file to adjust the settings of the server, you can use this command to execute it automatically. Supposing you have named it “server.cfg”, you’d need to use its name as the argument, resulting in the following: exec server. Upon inputting it and pressing Enter, the file will execute automatically, successfully adjusting your server as per your requirements, by running the sequence of commands inside the file.
Execute the bots.cfg File
There are plenty of commands you can use for bots in CS:GO and CS2, and if you’d like to automatically execute them, the best way to do it is by creating a .cfg file with your preferred sequence of bot commands.
For instance, let’s suppose it’s called “bots.cfg” and you want to execute it directly from the game, you’d need to input the following via console: exec bots. Upon pressing Enter, all the commands from the bots.cfg will be executed, successfully adjusting the settings of the game according to your requirements.
Execute the demos.cfg File
If you have a script file named demos.cfg, which contains a specific sequence of commands you’d like to execute quickly from the game, you can do it by using “demos” as the argument for the exec command, which will result in the following: exec demos. Simply input it in, press Enter and all the commands inside the “demos.cfg” file will be executed.
Execute the keybinds.cfg File
Key binds are a practical way to run specific commands by just clicking a specific key, and you can store all of these instructions inside a script file. If you’d like to execute multiple key binds instantly, you can do it thanks to the exec command.
Let’s suppose you have stored all of your key binds inside a file named “keybinds.cfg”, then you’d only need to input the following via console and press Enter: exec keybinds. Automatically, all the key binds will become activated.
Execute the training_rcon.cfg File
Let’s suppose you want to execute a specific sequence of RCON commands, and you have stored them inside the file named “training_rcon.cfg”. All you need to do is to use the name of the file as an argument, resulting in the following: exec training_rcon. Upon pressing Enter, the game will execute all the commands, successfully adjusting the game as per your requirements.
Execute the team.cfg File
If you would like to run a specific sequence of team commands, you can do it automatically by putting them together in a .cfg file and executing it with the exec command. Supposing the file is named “team.cfg”, all you need to do is to use the file name as an argument, resulting in the following: exec team.