This function returns the directory where the game's runner (executable) is stored. However, this may not always be useful, particularly as some devices run the executable from a *.zip file, so this would return that location no matter where the extracted executable is actually running from.
This is different from working_directory, which stores where the game's files are stored, however by default they are in the same location.
WARNING This 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.