Skip to content

Instantly share code, notes, and snippets.

@Clijsters
Last active July 29, 2016 18:25
Show Gist options
  • Save Clijsters/e95235eb8207863b6802 to your computer and use it in GitHub Desktop.
Save Clijsters/e95235eb8207863b6802 to your computer and use it in GitHub Desktop.
Requires the machine to be on AC Power before execution starts
@echo off
:test
wmic path win32_battery get batterystatus | find "2"
if %ERRORLEVEL% neq 0 (
echo Kein AC! Warte auf Strom
goto :while
)
goto :run
:while
wmic path win32_battery get batterystatus | find "2"
if %ERRORLEVEL% neq 0 (
goto :while
)
goto test
:run
echo Running...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment