cool hit counter The first thing you need to do is build a sleep shortcut for windows 2008._Intefrankly

The first thing you need to do is build a sleep shortcut for windows 2008.


----------------201607041343 update----------------

SetSystemPowerState is not working well again on the other computer, it doesn't respond at all when executed. Went back to try SetSuspendState again, this time simply changing the first parameter to 1, and it actually worked. But the documentation clearly says true is hibernate and false is sleep, is there a serious error in the documentation?

----------------20160628 original text----------------

I always like to use [Hibernate], but if the length of time you leave it is a bit awkward, and you don't want to leave it on to unnecessarily consume power, but also don't want to move it to hurt your hard drive, [Sleep] becomes a suitable option. Under XP/WIN7 and other desktop systems, it is easy to do the sleep/hibernate operation, just tap it in the start menu. But on a server system, like win2k8r2, it's not so convenient, you can't find a ready option in the start menu, and the most convenient way I can think of is to build a shortcut to the desktop and double-click on it to execute sleep or rest. Hibernation shortcuts are easy to build, the command line tool shutdown.exe directly supports hibernation operations, just write the target of the shortcut as follows.

%windir%System32shutdown.exe /h /f /t 0

But sleep how to do, the Internet search can be used rundll32 call SetSuspendState this API to achieve, according toMSDN The first parameter of the API is sleep mode as long as it is 0, and the remaining two parameters are arbitrary, so it can be written as follows.

%windir%System32
undll32.exe PowrProf.dll,SetSuspendState 0,0,0

But running on my computer, it's dormant It is not sleep I've tried changing the parameters and it still works. It's good that the documentation mentions another API with similar functionality: the SetSystemPowerState, which, according toMSDN The API has only two parameters, the 1st parameter is set to 1 for sleep and the 2nd parameter is useless, so the target of the shortcut is written as follows.

%windir%System32
undll32.exe Kernel32.dll,SetSystemPowerState 1,0

Once I tried it, it was the sleep I wanted and the problem was fixed. The documentation says that the API may be subsequently deprecated and suggests using SetSuspendState above instead ~ lol.

-Bunbi-


Recommended>>
1、Free access to Applet Cloud
2、Python Smart Explanation 6 Introduction to Python Custom Functions
3、The odd bugs encountered during testing
4、Share previously learned Data Analytics and Machine Learning Source Code and Learning Routes PPT
5、What blockchain and bitcoin have to say about each other

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号