Skip to content

Instantly share code, notes, and snippets.

@ErykDarnowski
Last active April 30, 2023 10:53
Show Gist options
  • Save ErykDarnowski/e2f9027a2fb575b4eb2b43e3f2b1bf58 to your computer and use it in GitHub Desktop.
Save ErykDarnowski/e2f9027a2fb575b4eb2b43e3f2b1bf58 to your computer and use it in GitHub Desktop.
How to automatically generate and open a battery report file on Windows
@echo off
:: Vars:
SET filename=battery-report.html
:: Generate the battery report file (in script's path):
powercfg /batteryreport > nul
:: Open the file (in the default browser):
start "" ./%filename%
:: Remove the file (after waiting 1s to allow the browser to load it):
timeout /t 2 /nobreak > nul
del %filename%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment