[Question]
  [
### Display the remaining battery charge, as a percentage of maximum charge
Remember if you can't run your code on a phone, calculator, etc, you can probably install your environment on a laptop at least. If you absolutely can't run on a device that has a battery, then unfortunately your language isn't eligible since you have no useful value to print.
You must display the results on the screen. This is theoretically supposed to be a handy utility for the user to check the battery. Writing battery percent to a file is too clunky, requiring the user to then check the file. Displaying on-screen is therefore a part of the specification that can't be overridden by default IO. That said, you can assume nothing is preventing things like STDOUT from being displayed on screen in the usual way. 
If the battery percent is already displayed on screen all the time by the OS, like on many phones, that does not mean you've got a zero-byte solution. You must assume that built-in display doesn't exist, and display the battery percent again somewhere else.
Edit: The output format is being opened up. You are free to display as little as just the digits of the percent, or the digits with some extra output as well.
Edit2: The digits representing the percent must appear in a known location within the output, not more than 50 lines from the end of the output, and that location shouldn't change between invocations. The digits representing the percent must be separated from other output by at least one non-digit character on each side. 
For reference here is the old output format from before the change:
`Remaining battery is ddd%`
or
`Remaining battery is ddd percent`
  
[Answer]
# Bash, ~~70~~ ~~67~~ ~~50~~ ~~46~~ ~~43~~ 16 bytes
```
`</*/*/*/B*/c*y`
```
Outputs: `<battery 0-100>: command not found`
Reads the file `/sys/class/power_supply/BAT1/capacity`.
Tested using Ubuntu 18.04 on a LENOVO ideapad 500.
Takes a while (since it searches the entire filesystem) - but it saves a byte!
### Old answer:
```
echo Remaining battery is `</*/*/*/B*/c*y`%
```
[Answer]
# JavaScript (browser), ~~78~~ ~~77~~ 50 bytes
(-1 byte thanks to [Benoit Esnard](https://codegolf.stackexchange.com/users/38454/benoit-esnard))
(-27 bytes since the output format is flexible now)
```
navigator.getBattery().then(b=>alert(b.level*100))
```
# JavaScript (browser), 46 bytes, by returning a promise
(Suggested by [Shaggy](https://codegolf.stackexchange.com/users/58974/shaggy), requires a header and footer)
```
f=
_=>navigator.getBattery().then(b=>b.level*100)
f().then(alert)
```
---
**Note:** Only works on Google Chrome >= 38 (desktop and Android) or any other browser that supports [Battery API](https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API). FireFox has removed this API due to privacy concerns.
**Example on Android (old output format):**
[![enter image description here](https://i.stack.imgur.com/jN9Zi.png)](https://i.stack.imgur.com/jN9Zi.png)
**Example on a Windows laptop (old output format):**
[![enter image description here](https://i.stack.imgur.com/7jdq6.png)](https://i.stack.imgur.com/7jdq6.png)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 28 bytes
-26 (!) thanks to AdmBorkBork. Previous version -3 thanks to colsw.
```
((gwmi win32_battery)|% e*g)
```
[![enter image description here](https://i.stack.imgur.com/Haocv.png)](https://i.stack.imgur.com/Haocv.png)
`gwmi` is short for `Get-WmiObject`
`|%` takes the pattern `e*g` and finds the only matching property; `estimatedChargeRemaining`
[Answer]
# Bash+acpi, ~~43~~ 4 bytes
## New rules
```
acpi
```
output on form
```
Battery 0: Charging, 92%, 00:05:37 until charged
```
not sure if the rule change makes things more interesting, couldn't you dump any text that contains all strings 0 to 100 which would be valid output? Seems to lose the original intent if so.
## Old rules
```
set `acpi`;echo Remaining battery is ${4%,}
```
output on form
```
Remaining battery is 92%
```
Don't ask me why set works like this, but it does.
[Answer]
# [Python 3.6](https://docs.python.org/3/) + [`psutil`](https://pypi.org/project/psutil/), 80 bytes
```
import psutil
print(f"Remaining battery is {psutil.sensors_battery().percent}%")
```
[Try it online!](https://tio.run/##LcoxCoAwDADA3VcUQWiXLv7ED0iVqAGbhiQORXx7HXS@42pHobE1zFzEHOtleHYsSOa3foKckJB2tyQzkOpQ3f2lqEBaROeffIgMsgLZM/ShtRc "Python 3 – Try It Online")
If the machine has no battery (like on TIO), the program will throw an error, because `psutil.sensors_battery()` returns `None`.
This requires Python 3.6 for [string interpolation](https://www.python.org/dev/peps/pep-0498/).
[Answer]
# C (win32, gcc i686-w64-mingw32), 78 bytes
```
#include<windows.h>
main(s){GetSystemPowerStatus(&s);printf("%hhu",s>>16);}
```
Abuses the win32 API by letting `GetSystemPowerStatus()` write "somewhere" on the stack, the interesting member is in the third byte, according to the [`SYSTEM_POWER_STATUS` struct](https://docs.microsoft.com/de-de/windows/desktop/api/winbase/ns-winbase-_system_power_status).
Unfortunately, the `#include` seems to be needed, probably because of calling conventions.
Example output:
```
> bat.exe
90
```
Displays `255` on systems without a battery.
[Answer]
# Excel VBA, 150 bytes
Restricted to 32-Bit Windows Installs of office, because the windows Kernel32 call is not 64-bit pointer safe.
Outputs to the cell `A1` on the ActiveSheet.
```
Declare Sub GetSystemPowerStatus Lib"kernel32"(f As t)
Type t
i As Integer
b As Byte
End Type
Sub d
Dim e As t
GetSystemPowerStatus e
[A1]=e.b
End Sub
```
-26 bytes thanks to flexible output
-7 bytes thanks to [@Neil](https://codegolf.stackexchange.com/users/17602/neil) for using an Int instead of 2 bytes
[Answer]
# [QPython for Android](http://www.qpython.org/index.html), 133 bytes
```
from androidhelper import*
d=Android()
d.batteryStartMonitoring()
d.dialogCreateAlert(str(d.batteryGetLevel()[1])+"%")
d.dialogShow()
```
[![Code screen](https://i.stack.imgur.com/Oxy2E.png)](https://i.stack.imgur.com/Oxy2E.png)
[![Output screen](https://i.stack.imgur.com/AK1BG.png)](https://i.stack.imgur.com/AK1BG.png)
The `+"%"` isn't strictly necessary since it uses the newer more flexible output format anyway, but it makes for slightly nicer output at just +4 bytes. 
[Answer]
# Emacs Lisp, 9 bytes
```
(battery)
```
Shows current battery status in mini-buffer at the bottom (or to stdout when using `--batch`) in format such as: `Power N/A, battery Unknown (99.1% load, remaining time N/A)`.
Should work on Windows, OSX, BSD , and Linux. 
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 60 bytes
```
Ox`nàÀÓ&.getBÂjry().È(x=>O.q("Rà@°á ßMy  "+L*x.¤vel+"%"))
```
[Test it](https://ethproductions.github.io/japt/?v=1.4.5&code=T3hgbuDA0yYuZ2V0QsJqcnkoKS7IASh4PT5PLnEoIlLgQLDhIN9NgHkgiSAiK0wqeC6kdmVsKyIlIikp&input=)
[Answer]
# Java, 546 bytes (Windows XP or Higher)
The powercfg utility came into play for WindowsXP, I have no idea what utilities were available prior to this. I must also be run as administrator. This is god-awful and I didn't make an extreme golfing attempt...
```
import java.io.*;import java.util.Scanner;public class J {public static void main(String[] args)throws Exception{Process p=Runtime.getRuntime().exec("powercfg energy");p.waitFor();Scanner s=new Scanner(new File("C:\\windows\\system32\\energy-report.html"));String x;double a=0,b=0;while(s.hasNextLine()){x=s.nextLine();if(x.contains("Design Capacity")){s.nextLine();b=Integer.parseInt(s.nextLine().replaceAll("\\D+",""));}else if(x.contains("Last Full Charge")){s.nextLine();a=Integer.parseInt(s.nextLine().replaceAll("\\D+",""));}}System.out.print(a/b*100);}}
```
Formatted / commented...
```
import java.io.*;
import java.util.Scanner;
public class J {
    public static void main(String[] args) throws Exception {
        Process p = Runtime.getRuntime().exec("powercfg energy"); // Run CMD sys32 app.
        p.waitFor();                                              // Wait for it.
        Scanner s = new Scanner(new File(
                "C:\\windows\\system32\\energy-report.html"));    // Read output.
        String x;
        double a = 0, b = 0;
        while (s.hasNextLine()) {
            x = s.nextLine();
            if (x.contains("Design Capacity")) {                   // Find max capacity.
                s.nextLine();
                b = Integer.parseInt(s.nextLine().replaceAll("\\D+", ""));
            } else if (x.contains("Last Full Charge")) {           // Find current capacity.
                s.nextLine();
                a = Integer.parseInt(s.nextLine().replaceAll("\\D+", ""));
            }
        }
        System.out.print(a / b * 100); // Calculate %.
    }
}
```
Honestly I was more interested to see if it was even possible in Java.
]