Skip to content

Instantly share code, notes, and snippets.

@MagicalDrizzle
Created May 12, 2022 18:51
Show Gist options
  • Save MagicalDrizzle/373f65356f6f65fbe6dd0b442520109e to your computer and use it in GitHub Desktop.
Save MagicalDrizzle/373f65356f6f65fbe6dd0b442520109e to your computer and use it in GitHub Desktop.
small batch scripts to do tedious stuffs
REM brightness control in winPE where most of the time there's no brightness bar
REM seems to only work on laptops
REM mostly copypasted from stackoverflow and I just added some QoL stuffs
@echo off
set ACDC=DC
WMIC /NameSpace:\\root\WMI Path BatteryStatus Get PowerOnline | find /i "true" > nul && set ACDC=AC
for /f "tokens=*" %%i in ('powercfg -q ^| find "(Display brightness)"') do set brtnss=%%i
set brtnss=%brtnss:~20,36%
:BRN
powercfg -q SCHEME_CURRENT SUB_VIDEO %brtnss% | find "Current %ACDC%"
set /P brightness=Enter % brightness: %=%
powercfg -Set%ACDC%ValueIndex SCHEME_CURRENT SUB_VIDEO %brtnss% %brightness%
powercfg -S SCHEME_CURRENT
goto BRN
REM make hoverboard portable https://github.com/AMDmi3/hoverboard-sdl
@echo off
if exist "%cd%\hoverboard.state" (
mkdir %USERPROFILE%\APPDATA\roaming\hoverboard
copy /Y %cd%\hoverboard.state %USERPROFILE%\APPDATA\roaming\hoverboard\
)
start "" hoverboard.exe
:HOVER
tasklist /fi "imagename eq hoverboard.exe" | find ":" > nul
if errorlevel 1 (
TIMEOUT /T 10 /NOBREAK
goto HOVER
) else (
copy /Y %USERPROFILE%\APPDATA\roaming\hoverboard\hoverboard.state %cd%\
)
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment