Suspend or hibernate from PowerShell

前端 未结 4 2001
一生所求
一生所求 2021-02-01 20:49

I am interested in using Windows PowerShell to suspend or hibernate a computer. How do you achieve this?

I am already aware of the Stop-Computer and R

4条回答
  •  梦如初夏
    2021-02-01 20:49

    Hope you find these useful.

    Shutdown %windir%\System32\shutdown.exe -s

    Reboot %windir%\System32\shutdown.exe -r

    Logoff %windir%\System32\shutdown.exe -l

    Standby %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Standby

    Hibernate %windir%\System32\rundll32.exe powrprof.dll,SetSuspendState Hibernate

    EDIT: As pointed out in comment by @mica, the suspend (sleep) actually hibernates. Apparently this happens in windows 8 and above. To 'sleep', disable hibernation OR get an external Microsoft tool (not built-in) "One of Microsoft's Sysinternals tool is PsShutdown using the command psshutdown -d -t 0 it will correctly sleep, not hibernate, a computer" Source: https://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu

提交回复
热议问题