This function returns the directory where the game executable is stored. However, this may not always be useful, particularly as some devices run the exe from a *.zip file, so this would return the same no matter where the game is actually running from.
WARNING This function may not work as you expect due to GameMaker being sandboxed! Please see the section on The File System for more information.
WARNING GameMaker doesn't limit writing to this directory so whether this is possible depends on OS permissions. It is however discouraged that you write to program_directory, as it is possible to damage the game installation this way.
NOTE The program_directory variable stores the path including the final slash.
program_directory
dir = program_directory;
This will store the directory where the executable is stored in a variable.