How can I change what closing the lid does on my Windows laptop with a batch file?

0

I got to the point of

@echo off

powercfg /S SCHEME_BALANCED

powercfg /SETACVALUEINDEX SCHEME_BALANCED SUB_BUTTONS LIDACTION 0

powercfg /SETDCVALUEINDEX SCHEME_BALANCED SUB_BUTTONS LIDACTION 0

When I run this, the power options GUI doesn't change until i refresh it, and even if I do it doesn't always work. The GUI says it won't sleep when I close the lid but it does. Any way to fix this or a different way to do the same thing?

relativelygood

Posted 2018-10-22T18:06:58.947

Reputation: 1

Possible duplicate of Change what closing the lid does, from the commandline?

Would the answers there be of any benefit?

– Moses – 2018-10-22T21:35:15.047

1Yes, I did use that and the code I have above is what I got from it. It didn't work though. I have, however fixed it, by adding powercfg /S SCHEME_BALANCED to the end again. I noticed that running it twice worked so I tried to do that and it worked. No idea why – relativelygood – 2018-10-24T19:36:42.980

Interesting. In that case, I retracted my close vote. Your comment has some valuable info that solved the issue. Feel free to add that as an answer to your own question, that's perfectly allowed. Welcome to Superuser! – Moses – 2018-10-24T21:40:09.330

Answers

0

I have fixed it by adding powercfg /S SCHEME_BALANCED to the end again. I noticed that running it twice worked so I tried to do that and it worked. No idea why

relativelygood

Posted 2018-10-22T18:06:58.947

Reputation: 1