On Linux you can set this in /sys/class/power_supply/BAT?/charge_{stop,start}_threshold – you can read and write a percentage (1-100) to there. You'll have to set it on every boot.
I assume there's some way to do this in Windows as well, but I don't know it.