aveyo

power_sleep

Apr 2nd, 2018
782
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off &mode 32,2 &color cf &title Power Sleep
  2. set "s1=$m='[DllImport ("Powrprof.dll", SetLastError = true)]"
  3. set "s2=static extern bool SetSuspendState(bool hibernate, bool forceCritical, bool disableWakeEvent);"
  4. set "s3=public static void PowerSleep(){ SetSuspendState(false, false, false); }';"
  5. set "s4=add-type -name Import -member $m -namespace Dll; [Dll.Import]::PowerSleep();"
  6. set "ps_powersleep=%s1%%s2%%s3%%s4%"
  7. call powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command "%ps_powersleep:"=\"%"
  8. exit
RAW Paste Data