I tried this when I first learned of it, but I never continued. This is what I know. I believe it is all correct.
The file is a regular text file and must have the .txt extension. The commands in it need to be correct, just like they are when typed directly into the console. Each command needs to be on a separate line.
The file must be in the directory where the GalCiv3.exe is located. For me it is at C:\Program Files (x86)\Steam\SteamApps\common\Galactic Civilizations III.
When using the console, the run command is used, and the .txt extension is not needed.
The console will appear to freeze while all the commands are run, then it will start working again.
You can use the run command to run another file after the first one, but there is another way. The run command can be used in the file, so when you run the first file, it can run another file. The run command can be used more than once in a file, so several other files can be run just by running the first file. Think of it as calling a subroutine. I hope this part makes sense.
Experiment and have fun.