Impossible to load last sketch at startup

james1095:
when I load it I want it to open up with a new blank sketch.

You can accomplish something like this by creating a shortcut that you use to start the Arduino IDE and adding the path to the blank sketch you want to load on startup. Something like this:

E:\ProgramFiles\ArduinoIDE\arduino-nightly\arduino.exe E:\ProgramFiles\ArduinoIDE\arduino-nightly\examples\01.Basics\BareMinimum\BareMinimum.ino

Or if you have .ino files associated with the Arduino IDE, you could just make a shortcut to the .ino file you want.

If you truly wanted a new blank sketch, you could make a script that first runs the command:

arduino --pref last.sketch0.path= --save-prefs

That will make it so the IDE forgets the last opened sketch an so falls back to the default behavior of opening a new sketch. Then runs the command to start the Arduino IDE:

arduino

The tricky thing is that the first command takes a ridiculously long time to finish and the preference is only saved after that is done. So you need to make sure your script only runs the second command once the first one is done. You might expect that to happen as a matter of course, but it's not so. A Windows batch file would look like this:

arduino --pref last.sketch0.path= --save-prefs | more
arduino

I couldn't figure out how to do something similar with a shell script so I resorted to a fixed delay:

./arduino.exe --pref last.sketch0.path= --save-prefs
sleep 10s
./arduino.exe

You can adjust the delay to a suitable length for your system. I'm certain there is a better way.