(Redirected from Execwithwhitelist)
exec is a console command available in all Source games.
It is used to execute CFG files, namely a sequence of console commands.
exec <filename> [path id]
The command executes the file
"//[path id]/cfg/<filename>" if it exists. The default value of
[path id] is
*, resulting in the default path
<filename>argument is the name of the file either with or without the .cfg extension. A path can also be prefixed. If the
<filename>argument is given, the game always prints the line
Execing config: <filename>in the console. If the file does not exist, the game also prints the line
exec: couldn't exec <filename>.
- The optional
[path id]argument can be used to specify a different path to execute CFG files from. Its first character must be
execcommand can be used in the launch options with
-exec <filename>, for example
-exec autoexecwill always execute the CFG file
<game>/cfg/autoexec.cfgwhen the game starts (which is overkill, because the game already executes autoexec.cfg even without this launch option).
execcan save a lot of time if a sequence of commands should be executed multiple times. Instead of typing the commands into the console every time, one can save them in a CFG file and execute it using
Warning: Recursive executions crash the game!
Example: If the CFG file
<game>/cfg/crash.cfgcontains the line
exec crash, then its execution will cause a game crash!
There are console commands that are identical to
exec, but with slight differences.
||There is no error message |
||All console commands in the specified CFG file are executed with whitelistcmd. Commands are ignored if they are not whitelisted in |