I would like if while building a solution my system wouldn't go to sleep, exactly like while watching movies, but after it's finished it would go to sleep like normally. And I didn't want to disable the sleep after 20 minutes from the power options.
Is there a solution for this like a short script perhaps that would execute a cmd command and prevent going to sleep for the duration of the command?
You can create a vbscript file called "nosleep.vbs"
Set osShell = CreateObject("Wscript.Shell")
thecmd = " powercfg.exe /change ""always on"" /monitor-timeout-ac 20"
osShell.Run "cmd " & thecmd
In Visual Studio you can call this nosleep.vbs code.
You can do this in the pre-build and post-build steps.
I am assuming you are running Visual Studio as administrator.
Depending on the OS Version, the parameters vary.
You can get more info here
http://technet.microsoft.com/en-us/library/cc748940(v=WS.10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With