This question already has an answer here:

I know that we can shut down windows after some specific time like this

shutdown -s -t <time>

But how can I do the same when I want my pc to sleep after some specific amount of time?? is there any command??

Also it will be helpful if you told me the command for Linux too, Cause i rarely use windows.

marked as duplicate by Run5k, Pimp Juice IT, fixer1234, djsmiley2k, DrZoo Oct 19 '17 at 20:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you looking to put the PC to sleep after say, 15 minutes or are you looking to put it to sleep at a particular time (say, 3:30PM) – uSlackr Oct 17 '17 at 19:09
  • 1
    I’m rather puzzled by the close votes.  This question asks how to put the PC to sleep after a delay for Windows and ideally also for Linux.  That question is about how to put the PC to sleep right now for Windows only.   Overlap?  Yes.  Duplicate?  No. – G-Man Oct 18 '17 at 18:18
  • @G-Man the marked answer in the other question mentions the method discussed here. – Burgi Oct 25 '17 at 7:53
  • @Burgi: What are you talking about? I read the linked question last week when I wrote the above comment; I read the accepted answer (I assume that’s what you mean by “the marked answer”) again, three times, just now. Yes, it discusses the rundll32.exe powrprof.dll,SetSuspendState 0,1,0 command, which is mentioned here (and yes, I deliberately switched the verbs), and which answers that question. And, as I said in my comment, the other question is about one-quarter of this question, and so its answer is one-quarter of an answer to this question. So what’s your point? – G-Man Oct 25 '17 at 16:42

The idea is from here and here.

We could create a sleep.bat file like:

@echo off
timeout %1 > NUL
rundll32.exe powrprof.dll,SetSuspendState 0,1,0

For geeks only: you can use copy con sleep.bat command then copy/past the text above, then hit Ctrl-Z to close the file. You may verify using the type sleep.bat command.


Since you want the Linux solution, on recent systems:

systemctl suspend
systemctl hibernate

If you want this to happen after a delay, combine with the sleep command:

sleep 1h 30m && systemctl suspend

You can also use the kshutdown utility that gives you a GUI to shutdown/sleep on various conditions: after some delay, at a specific time, or when some process terminates.

Not the answer you're looking for? Browse other questions tagged or ask your own question.