How do I create and configure an autoexec.cfg?
Make a plain text file called autoexec.cfg and drop it into your CS2 config directory at Steam/steamapps/common/Counter-Strike Global Offensive/game/csgo/cfg/. Write one command per line, and close the file with host_writeconfig. CS2 will process every instruction in this file automatically on startup.