Advertisement
Scrawlpace

2021 Legion 7 Power Switcher

Jul 19th, 2021 (edited)
2,982
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.23 KB | None | 0 0
  1. :: ==================================
  2. :: Legion Power Optimizations
  3. :: ==================================
  4. :: Automatically change power plan and screen refresh rate when
  5. :: the AC adaptor is connected or disconnected on your Lenovo Legion Laptop:
  6. ::
  7. :: - When unplugged, set screen refresh to 60hz and Power Plan to Quiet
  8. :: - When plugged, set screen refresh to 165hz and Power Plan to Balanced
  9. ::
  10. :: Only tested on a single Legion 7 5800H/3070RTX, so your mileage may vary.
  11. :: Use at your own risk.
  12. ::
  13. :: ==================================
  14. :: Installation
  15. :: ==================================
  16. :: - Save this script to "c:\tools\legion-power\apply-settings.bat" (or other directory of your choice)
  17. :: - Download http://tools.taubenkorb.at/change-screen-resolution/#download
  18. :: - Copy "ChangeScreenResolution.exe" to "c:\tools\legion-power"
  19. ::
  20. :: ==================================
  21. :: Task Setup
  22. :: ==================================
  23. :: Create a Windows Task which triggers when the AC Adaptor is inserted or unplugged:
  24. ::
  25. :: - Press START button and start typing "task scheduler"
  26. :: - Click "Task Scheduler" once it appears
  27. :: - Click "Action > Create Basic Task"
  28. :: - Follow the wizard using these settings: https://imgur.com/a/qvf6UNN
  29. :: - Once the task is created, right-click on it and select properties. The task settings will open in a new window.
  30. :: - Go through each tab and ensure the settings identical to https://imgur.com/a/U6io2Hm
  31.  
  32. @echo off
  33.  
  34. set exe=%~dp0ChangeScreenResolution.exe
  35. set width=2560
  36. set height=1600
  37. set colorBits=32
  38. set refreshBattery=60
  39. set refreshPlugged=165
  40. set pwrBattery=16edbccd-dee9-4ec4-ace5-2f0b5f2a8975
  41. set pwrPlugged=85d583c5-cf2e-4197-80fd-3789a227a72c
  42. set refresh=
  43. set pwrPlan=
  44.  
  45. set "batStatus="&for /f "skip=1 tokens=*" %%m in ('wmic PATH Win32_Battery Get BatteryStatus ') do if not defined batStatus set "batStatus=%%m"
  46.  
  47. if %batStatus% == 1 (
  48.     set refresh=%refreshBattery%
  49.     set pwrPlan=%pwrBattery%
  50. ) else (
  51.     set refresh=%refreshPlugged%
  52.     set pwrPlan=%pwrPlugged%
  53. )
  54.  
  55. if exist %exe% (
  56.     echo Setting refresh %exe%  
  57.     %exe% /w=%width% /h=%height% /f=%refresh% /d=0
  58. ) else (
  59.     echo Change refresh failed - %exe% not found
  60. )
  61.  
  62. powercfg -s %pwrPlan%
  63. echo Power Plan set to %pwrPlan%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement