Where does arduino IDE store the latest board selection? I'm building a tool to help me automate my uploading process. How do I know where Arduino stores the current preferences - which board, which com port, what serial speed?

If devs are familiar with using multiple boards in the same system ithey'd know it would be really handy to be able to change that
It is stored in preferences.txt in your Arduino data folder. 

You can find more about that file, including where to find it, here.

Some of the keys you may be interested in are:


board=uno
serial.port=COM3
serial.debug_rate=115200


However maybe for your workflow the Arduino IDE isn't the best tool for the job.  You may consider arduino-builder, which is the back-end that the Arduino IDE uses to do the actual compiling, or maybe another IDE entirely, such as PlatformIO or UECIDE.