How To Sleep A Computer Using Cmd
It s fairly easy to do to put a windows computer in sleep mode through the start menu or the power button.
How to sleep a computer using cmd. Then the rundll32 command will work correctly and put the pc to sleep. In the example above i ve used the powercfg command to disable hibernation just before using the rundll32 command. You can use m instead of m if you wish and optionally a colon between the w and the number. The target computer is the computer you want to shut down or restart.
Simply put running the following command puts the computer in sleep mode. The differences between the 2 s is sleep will leave the pc state in memory and will require a little juice to keep it current hibernate will write the current state to the hd hiberfil sys and requires no power. Here is an easy way to put your computer to sleep using the command prompt. When you use the sleep button from the start menu you can resume your computer from sleep by pressing a any key on your keyboard.
Here are a few options. Fyi on the shutdown exe you can use hibernate instead of sleep. If you want to pause the execution of a batch file for 50 seconds then you should insert below statement in your batch file. For instance if you want the computer to shut down in 2 hours the command should look like shutdown s t 7200.
But it would be nice to know if and how to do so from a command line. Type the ip address of the target computer s and click ok. Hi muniyappank you can enter the below commands to do so the equivalent of setting them to never. Especially for laptops sleep is a good standby mode when you are not using the system for quite some time.
Powercfg h off rundll32 exe powrprof dll setsuspendstate 0 1 0 powercfg h on. It saves battery and also keeps the system cool while keeping it just enough active that whenever you hit a key everything comes back to life again. If you are not sure what the private ip address is for the target computer you can find it using that computer. Type the ip address of that computer in the add computers window and click ok.
Be careful to include the w argument without it the whole computer is put to sleep. If you want to restart your computer on a delay use shutdown r t xxxx instead. Using this command line makes is resume much slower due to the deeper sleep state and it can resume only if you press the power button on your computer. Sleep command should also work find on server 2008 and server 2008 r2.
Sleep w2000 in a dos script cmd or bat to wait for 2s 2000 ms substitute the time in ms you need. It cannot resume for a key press. So you can create a batch file sleep cmd with the following contents.