If your battery's "power remaining" meter is broken and always shows 0%,
Windows will always power down immediately when running on battery. To
disable the auto shutdown / auto hibernate feature:

Open an administrator console (cmd.exe with administrator rights).

Type: powercfg -setdcvalueindex SCHEME_CURRENT SUB_BATTERY BATACTIONCRIT 0

(This modifies the power scheme currently active, so if you need to modify an other, switch schemes.)