Created
March 13, 2023 19:32
-
-
Save masterflitzer/aa4952dafe0272adbfd258e0518feaa7 to your computer and use it in GitHub Desktop.
Log current battery charge on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while ($true) { | |
$charge = Get-CimInstance -ClassName Win32_Battery | Select-Object -ExpandProperty EstimatedChargeRemaining | |
Write-Output "Current Charge: ${charge}%" | Tee-Object -Append "$([System.Environment]::GetFolderPath("Desktop"))/battery.log" | |
Start-Sleep -Seconds 30 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment