讓 Windows 7 在 x 秒後進入睡眠狀態

讓 Windows 7 在 x 秒後進入睡眠狀態

當我自己在睡前開始一項長時間處理工作時,我經常跑步

shutdown -s -t 3600

使電腦在 3600 秒後自動關閉。

如何做同樣的事情來要求電腦在 x 秒後進入睡眠狀態?

我試過

shutdown -h -t 60

但1)它甚至不起作用,無論如何2)這會使電腦進入休眠狀態,這是我不想要的(我更喜歡睡眠模式)。

筆記:這個答案並不能解決問題,因為它不允許指定睡覺前的時間。

答案1

如何讓 Windows 7 在 x 秒後進入睡眠狀態?

使用以下批次文件,並以管理員身份執行

@echo off
rem disable hibernate
powercfg -hibernate off
rem wait x seconds, eg 1 hour
timeout 3600 /nobreak
rem sleep
%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0

進一步閱讀

答案2

一句話(基於 DavidPostill 接受的答案):

timeout /T 3600 & rundll32.exe powrprof.dll,SetSuspendState 0,1,0

為了確保它有效,您可以像這樣嘗試:

timeout /t 10 & notepad

記事本應在 10 秒後打開。

重要提示:如果您已git安裝在電腦上,其bin資料夾可能位於 中PATH,並且timeout在命令列中執行操作將運行 C:\Program Files\Git\usr\bin\timeout.exe而不是預設的C:\Windows\System32\timeout.exe!在這種情況下,您必須包含 的完整路徑timeout,才能使用 Windows 逾時工具。

相關內容