开发者

Disable system sleep during long builds

开发者 https://www.devze.com 2022-12-27 00:03 出处:网络
From time to time I need to run a full build of the entire tool chain for our software on my development machine. To save on power my I\'ve got my dev machine set to go sleep after 20 minutes of inact

From time to time I need to run a full build of the entire tool chain for our software on my development machine. To save on power my I've got my dev machine set to go sleep after 20 minutes of inactivity. Building the full tool chain can take up to an hour and I'll often just go to lunch. However, if I forget to disable sleep开发者_如何学Python I can return to a sleeping machine with the build only partially complete.

What I'm looking for is a way to automatically disable sleep while MSBuild is running. Does anyone know of a simple way of doing this?


Add pre-build/post-build events to stop and start the power service respectively perhaps ? Create a power scheme that disables sleeping and then add use the powercfg /setactive switch. For example:

powercfg /setactive YourNewSchemesGUID

GUIDs can be enumerated using the /query switch.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号