Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Desktop shortcut to tell computer to sleep in 25 minutes

22 Nov 2014   #1
LongApple

Windows 7 Professional 64 Bit
 
 
Desktop shortcut to tell computer to sleep in 25 minutes

How to force sleep/force shut down a laptop after X time no matter what

I am having trouble getting the sleep command to work
http://i.imgur.com/YbEorGz.png

Also where do I put the time? Shouldn't there be an XX or 00 like in the shutdown command? Is what I am typing into cmd prompt wrong?


My System SpecsSystem Spec
.
22 Nov 2014   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hello LongApple,

Firstly, it's 'rundll32.exe'. Not 'rund1132.exe'.

Secondly...

Quote   Quote: Originally Posted by LongApple View Post
I am having trouble getting the sleep command to work[.] Also where do I put the time? Shouldn't there be an XX or 00 like in the shutdown command? Is what I am typing into cmd prompt wrong?
Rundll32 is not a command. It is a wrapper program that's purpose is to launch other programs stored within dll files and should never be invoked by the user directly; not through the command prompt, not through shourtcuts.

Forcing Windows to sleep using this method is considered dangerous.


You should instead be using "Control Panel\Hardware and Sound\Power Options\Edit Plan Settings" to choose when your computer sleeps.

Desktop shortcut to tell computer to sleep in 25 minutes-poweroptions1.jpeg
Desktop shortcut to tell computer to sleep in 25 minutes-poweroptions2.jpeg


If you really want your computer to sleep through a shortcut/command, it's recommended you download PsShutdown from here and create a shortcut to that instead.


My System SpecsSystem Spec
22 Nov 2014   #3
Ztruker

Windows 10 Pro X64
 
 

Not sure why this would be dangerous. I just tried it and it worked fine.

rundll32.exe powrprof.dll,SetSuspendState 0,1,1


Would need to put this in a batch file, something like:

timeout 1800
rundll32.exe powrprof.dll,SetSuspendState 0,1,1


Quote:
>timeout /?

TIMEOUT [/T] timeout [/NOBREAK]

Description:
This utility accepts a timeout parameter to wait for the specified
time period (in seconds) or until any key is pressed. It also
accepts a parameter to ignore the key press.

Parameter List:
/T timeout Specifies the number of seconds to wait.
Valid range is -1 to 99999 seconds.

/NOBREAK Ignore key presses and wait specified time.

/? Displays this help message.

NOTE: A timeout value of -1 means to wait indefinitely for a key press.

Examples:
TIMEOUT /?
TIMEOUT /T 10
TIMEOUT /T 300 /NOBREAK
TIMEOUT /T -1
My System SpecsSystem Spec
.

22 Nov 2014   #4
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

A quote from a user at Superuser.com briefly describes Rundll32s problems by invoking Rundll32 this way.

windows 7 - What is the command to use to put your computer to sleep (not hibernate)? - Super User

Quote   Quote: Originally Posted by accolade
rundll32.exe PowrProf.dll,SetSuspendState is not recommended. It is dangerous. (Because it corrupts the stack, as it does not comply with the function signature demanded by Rundll32. Then unforeseeable bad things may happen, as Raymond Chen warns)
Also see Michaels post How to use Rundll32 to execute DLL Function? - Stack Overflow

Quote   Quote: Originally Posted by Michael
Rundll32 only supports running DLL exports with the following signature:
void CALLBACK EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);It does not support running arbitrary entry points. Since ShellExecute does not have that signature, clearly bad things will happen.
INFO: Windows Rundll and Rundll32 Interface has more info on the rundll32 interface.
If you want to do the equivelent of ShellExecute from the command line, just use start:
C:\>start "C:\Documents and Settings\admin\Desktop\tmp"
My System SpecsSystem Spec
23 Nov 2014   #5
Ztruker

Windows 10 Pro X64
 
 

Does that warning apply in this case? It did not cause me any harm and I ran it several times.

For completeness:

The command I gave, rundll32.exe powrprof.dll,SetSuspendState 0,1,1, suspends the computer.

This one, Rundll32.exe Powrprof.dll,SetSuspendState Sleep, puts it to sleep.
My System SpecsSystem Spec
Reply

 Desktop shortcut to tell computer to sleep in 25 minutes




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Remote Desktop Connection Shortcut - Create for Specific Computer
How to Create a "Remote Desktop Connection" Shortcut to a Specific Computer This tutorial will show you how to create a custom Remote Desktop Connection (RDC) shortcut that opens a RDC to a specific computer in Vista, Windows 7, and Windows 8. While all editions of Vista, Windows 7, and...
Tutorials
Computer takes about 1.5 minutes to load the desktop + icons
Granted my computer's now 4-5 years old. I was wondering if anyone has an idea on this. I ran chkdsk, Malwarebytes, and Ccleaner. All were clear but the last, which fixed many things, but I still have the issue. I have minimal programs that run on start-up, so I highly doubt it's that. I...
Performance & Maintenance
Custom 'Desktop (create shortcut)' Remove .fileextension - Shortcut
Hi guys n girls, I have for ever got sick and tired of right click -> open Send to Menu and creating a Desktop Shortcut for a file or app....then needing to go to the Desktop right click the newly made shortcut and then removing the trailing file extension, dash and words shortcut in brackets....
Customization
Shortcut to Desktop on Win2K Computer?
I'd sure be grateful if someone reading this could explain to me (or remind me?) how to create a shortcut on my Windows 7 desktop, that would open up a separate window displaying the contents of the desktop on another computer running Windows XP or Windows 2000. I have to admit that in my old...
Network & Sharing
Since 9/16/2012, computer wakes from sleep in 2-3 minutes
I've got a pretty regular and predictable usage pattern with my computer - quick logon in the morning to check emails, go to work, use computer at night, restart before bed. The computer is set to sleep after three hours of inactivity. So in the morning it will be sleeping, then when I get home...
Performance & Maintenance
How can I make my computer go to sleep after 2 minutes?
I'm running windows 7 and I want to make it go to sleep when it's at the login screen and no one touches the computer for 2 minutes.
Performance & Maintenance


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 23:26.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App