Change what closing the lid does, from the commandline?
up vote
8
down vote
favorite
I wonder if anybody knows a utility, or command, which can change this setting in windows in one click. I often need to change it on my laptop whether I want it to do nothing when the lid is closed or go to sleep.
I'm sure it's possible to change somehow from the command line.
windows-7 command-line power
add a comment |
up vote
8
down vote
favorite
I wonder if anybody knows a utility, or command, which can change this setting in windows in one click. I often need to change it on my laptop whether I want it to do nothing when the lid is closed or go to sleep.
I'm sure it's possible to change somehow from the command line.
windows-7 command-line power
add a comment |
up vote
8
down vote
favorite
up vote
8
down vote
favorite
I wonder if anybody knows a utility, or command, which can change this setting in windows in one click. I often need to change it on my laptop whether I want it to do nothing when the lid is closed or go to sleep.
I'm sure it's possible to change somehow from the command line.
windows-7 command-line power
I wonder if anybody knows a utility, or command, which can change this setting in windows in one click. I often need to change it on my laptop whether I want it to do nothing when the lid is closed or go to sleep.
I'm sure it's possible to change somehow from the command line.
windows-7 command-line power
windows-7 command-line power
edited Mar 11 '16 at 18:03
Ƭᴇcʜιᴇ007
98.5k14155212
98.5k14155212
asked Feb 7 '15 at 8:24
bame2
46112
46112
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
18
down vote
Taken from Set On Lid Close Power Option. There is also a script or two on this page, but the method reproduced below is the best, IMHO.
You can set it through powercfg
commands.
The pre-configured schemes have the following GUIDs:
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
I'll use the Balanced scheme for my examples, but you would use the GUID provided by:
powercfg -GETACTIVESCHEME
You can find the GUIDs for subgroups and power settings as well as the index values for each power setting by running a query command with your scheme GUID:
powercfg -Q 381b4222-f694-41f0-9685-ff5bb260df2e
Looking through the output, you will discover that the subgroup GUID you want is:
Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347 (Power buttons and lid)
and the power setting:
Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936 (Lid close action)
with index options:
Possible Setting Index: 000
Possible Setting Friendly Name: Do nothing
Possible Setting Index: 001
Possible Setting Friendly Name: Sleep
Possible Setting Index: 002
Possible Setting Friendly Name: Hibernate
Possible Setting Index: 003
Possible Setting Friendly Name: Shut down
So in order to configure your system to Shut down when the lid is closed, you would run:
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
AC for the "Plugged In" action and DC for the "On Battery" action.
Hope this helps.
Please note that I have not block quoted, as it messed up the rather long code lines. So for the sake of formatting, I have left it unquoted.
add a comment |
up vote
1
down vote
powercfg
supports aliases for guids (scheme names, groups etc)
@echo off
powercfg /s scheme_min
rem scheme_min is high performance
powercfg /setacvalueindex scheme_min sub_buttons lidaction 0
rem under buttons group; plugged in
powercfg /setdcvalueindex scheme_min sub_buttons lidaction 0
rem dc means on battery
rem check with powercfg.cpl gui
rem use powercfg /aliases for aliases instead of guid numbers
rem query with powercfg /q
this script above would switch to high performance scheme and set the lid action (When I close the lid:
) under it to be None
on both cases (either plugged or when on battery).
it is basically three lines of code as the rest are almost just comments (remarks).
add a comment |
up vote
0
down vote
The following seems the easiest and also somewhat readable way to change the behavior from command line for the currently active power scheme (thanks to w17t's answer and this TenForums post):
DoNothingWhenClosingTheLid.bat
::Do nothing when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 0
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 0
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
GoToSleepWhenClosingTheLid.bat
::Go to sleep/standby mode when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 1
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 1
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f874849%2fchange-what-closing-the-lid-does-from-the-commandline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
18
down vote
Taken from Set On Lid Close Power Option. There is also a script or two on this page, but the method reproduced below is the best, IMHO.
You can set it through powercfg
commands.
The pre-configured schemes have the following GUIDs:
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
I'll use the Balanced scheme for my examples, but you would use the GUID provided by:
powercfg -GETACTIVESCHEME
You can find the GUIDs for subgroups and power settings as well as the index values for each power setting by running a query command with your scheme GUID:
powercfg -Q 381b4222-f694-41f0-9685-ff5bb260df2e
Looking through the output, you will discover that the subgroup GUID you want is:
Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347 (Power buttons and lid)
and the power setting:
Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936 (Lid close action)
with index options:
Possible Setting Index: 000
Possible Setting Friendly Name: Do nothing
Possible Setting Index: 001
Possible Setting Friendly Name: Sleep
Possible Setting Index: 002
Possible Setting Friendly Name: Hibernate
Possible Setting Index: 003
Possible Setting Friendly Name: Shut down
So in order to configure your system to Shut down when the lid is closed, you would run:
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
AC for the "Plugged In" action and DC for the "On Battery" action.
Hope this helps.
Please note that I have not block quoted, as it messed up the rather long code lines. So for the sake of formatting, I have left it unquoted.
add a comment |
up vote
18
down vote
Taken from Set On Lid Close Power Option. There is also a script or two on this page, but the method reproduced below is the best, IMHO.
You can set it through powercfg
commands.
The pre-configured schemes have the following GUIDs:
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
I'll use the Balanced scheme for my examples, but you would use the GUID provided by:
powercfg -GETACTIVESCHEME
You can find the GUIDs for subgroups and power settings as well as the index values for each power setting by running a query command with your scheme GUID:
powercfg -Q 381b4222-f694-41f0-9685-ff5bb260df2e
Looking through the output, you will discover that the subgroup GUID you want is:
Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347 (Power buttons and lid)
and the power setting:
Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936 (Lid close action)
with index options:
Possible Setting Index: 000
Possible Setting Friendly Name: Do nothing
Possible Setting Index: 001
Possible Setting Friendly Name: Sleep
Possible Setting Index: 002
Possible Setting Friendly Name: Hibernate
Possible Setting Index: 003
Possible Setting Friendly Name: Shut down
So in order to configure your system to Shut down when the lid is closed, you would run:
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
AC for the "Plugged In" action and DC for the "On Battery" action.
Hope this helps.
Please note that I have not block quoted, as it messed up the rather long code lines. So for the sake of formatting, I have left it unquoted.
add a comment |
up vote
18
down vote
up vote
18
down vote
Taken from Set On Lid Close Power Option. There is also a script or two on this page, but the method reproduced below is the best, IMHO.
You can set it through powercfg
commands.
The pre-configured schemes have the following GUIDs:
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
I'll use the Balanced scheme for my examples, but you would use the GUID provided by:
powercfg -GETACTIVESCHEME
You can find the GUIDs for subgroups and power settings as well as the index values for each power setting by running a query command with your scheme GUID:
powercfg -Q 381b4222-f694-41f0-9685-ff5bb260df2e
Looking through the output, you will discover that the subgroup GUID you want is:
Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347 (Power buttons and lid)
and the power setting:
Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936 (Lid close action)
with index options:
Possible Setting Index: 000
Possible Setting Friendly Name: Do nothing
Possible Setting Index: 001
Possible Setting Friendly Name: Sleep
Possible Setting Index: 002
Possible Setting Friendly Name: Hibernate
Possible Setting Index: 003
Possible Setting Friendly Name: Shut down
So in order to configure your system to Shut down when the lid is closed, you would run:
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
AC for the "Plugged In" action and DC for the "On Battery" action.
Hope this helps.
Please note that I have not block quoted, as it messed up the rather long code lines. So for the sake of formatting, I have left it unquoted.
Taken from Set On Lid Close Power Option. There is also a script or two on this page, but the method reproduced below is the best, IMHO.
You can set it through powercfg
commands.
The pre-configured schemes have the following GUIDs:
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced)
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
I'll use the Balanced scheme for my examples, but you would use the GUID provided by:
powercfg -GETACTIVESCHEME
You can find the GUIDs for subgroups and power settings as well as the index values for each power setting by running a query command with your scheme GUID:
powercfg -Q 381b4222-f694-41f0-9685-ff5bb260df2e
Looking through the output, you will discover that the subgroup GUID you want is:
Subgroup GUID: 4f971e89-eebd-4455-a8de-9e59040e7347 (Power buttons and lid)
and the power setting:
Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936 (Lid close action)
with index options:
Possible Setting Index: 000
Possible Setting Friendly Name: Do nothing
Possible Setting Index: 001
Possible Setting Friendly Name: Sleep
Possible Setting Index: 002
Possible Setting Friendly Name: Hibernate
Possible Setting Index: 003
Possible Setting Friendly Name: Shut down
So in order to configure your system to Shut down when the lid is closed, you would run:
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 3
AC for the "Plugged In" action and DC for the "On Battery" action.
Hope this helps.
Please note that I have not block quoted, as it messed up the rather long code lines. So for the sake of formatting, I have left it unquoted.
edited Feb 7 '15 at 18:58
answered Feb 7 '15 at 9:00
Greenonline
1,2663823
1,2663823
add a comment |
add a comment |
up vote
1
down vote
powercfg
supports aliases for guids (scheme names, groups etc)
@echo off
powercfg /s scheme_min
rem scheme_min is high performance
powercfg /setacvalueindex scheme_min sub_buttons lidaction 0
rem under buttons group; plugged in
powercfg /setdcvalueindex scheme_min sub_buttons lidaction 0
rem dc means on battery
rem check with powercfg.cpl gui
rem use powercfg /aliases for aliases instead of guid numbers
rem query with powercfg /q
this script above would switch to high performance scheme and set the lid action (When I close the lid:
) under it to be None
on both cases (either plugged or when on battery).
it is basically three lines of code as the rest are almost just comments (remarks).
add a comment |
up vote
1
down vote
powercfg
supports aliases for guids (scheme names, groups etc)
@echo off
powercfg /s scheme_min
rem scheme_min is high performance
powercfg /setacvalueindex scheme_min sub_buttons lidaction 0
rem under buttons group; plugged in
powercfg /setdcvalueindex scheme_min sub_buttons lidaction 0
rem dc means on battery
rem check with powercfg.cpl gui
rem use powercfg /aliases for aliases instead of guid numbers
rem query with powercfg /q
this script above would switch to high performance scheme and set the lid action (When I close the lid:
) under it to be None
on both cases (either plugged or when on battery).
it is basically three lines of code as the rest are almost just comments (remarks).
add a comment |
up vote
1
down vote
up vote
1
down vote
powercfg
supports aliases for guids (scheme names, groups etc)
@echo off
powercfg /s scheme_min
rem scheme_min is high performance
powercfg /setacvalueindex scheme_min sub_buttons lidaction 0
rem under buttons group; plugged in
powercfg /setdcvalueindex scheme_min sub_buttons lidaction 0
rem dc means on battery
rem check with powercfg.cpl gui
rem use powercfg /aliases for aliases instead of guid numbers
rem query with powercfg /q
this script above would switch to high performance scheme and set the lid action (When I close the lid:
) under it to be None
on both cases (either plugged or when on battery).
it is basically three lines of code as the rest are almost just comments (remarks).
powercfg
supports aliases for guids (scheme names, groups etc)
@echo off
powercfg /s scheme_min
rem scheme_min is high performance
powercfg /setacvalueindex scheme_min sub_buttons lidaction 0
rem under buttons group; plugged in
powercfg /setdcvalueindex scheme_min sub_buttons lidaction 0
rem dc means on battery
rem check with powercfg.cpl gui
rem use powercfg /aliases for aliases instead of guid numbers
rem query with powercfg /q
this script above would switch to high performance scheme and set the lid action (When I close the lid:
) under it to be None
on both cases (either plugged or when on battery).
it is basically three lines of code as the rest are almost just comments (remarks).
answered Oct 17 '17 at 18:27
w17t
2,23441637
2,23441637
add a comment |
add a comment |
up vote
0
down vote
The following seems the easiest and also somewhat readable way to change the behavior from command line for the currently active power scheme (thanks to w17t's answer and this TenForums post):
DoNothingWhenClosingTheLid.bat
::Do nothing when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 0
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 0
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
GoToSleepWhenClosingTheLid.bat
::Go to sleep/standby mode when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 1
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 1
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
add a comment |
up vote
0
down vote
The following seems the easiest and also somewhat readable way to change the behavior from command line for the currently active power scheme (thanks to w17t's answer and this TenForums post):
DoNothingWhenClosingTheLid.bat
::Do nothing when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 0
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 0
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
GoToSleepWhenClosingTheLid.bat
::Go to sleep/standby mode when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 1
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 1
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
add a comment |
up vote
0
down vote
up vote
0
down vote
The following seems the easiest and also somewhat readable way to change the behavior from command line for the currently active power scheme (thanks to w17t's answer and this TenForums post):
DoNothingWhenClosingTheLid.bat
::Do nothing when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 0
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 0
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
GoToSleepWhenClosingTheLid.bat
::Go to sleep/standby mode when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 1
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 1
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
The following seems the easiest and also somewhat readable way to change the behavior from command line for the currently active power scheme (thanks to w17t's answer and this TenForums post):
DoNothingWhenClosingTheLid.bat
::Do nothing when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 0
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 0
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
GoToSleepWhenClosingTheLid.bat
::Go to sleep/standby mode when you close the lid
powercfg /setacvalueindex scheme_current sub_buttons lidaction 1
powercfg /setdcvalueindex scheme_current sub_buttons lidaction 1
::Re-activate current scheme to make settings take effect immediately
powercfg /setactive scheme_current
edited Dec 5 at 10:32
answered Dec 4 at 15:40
Marcus Mangelsdorf
511517
511517
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f874849%2fchange-what-closing-the-lid-does-from-the-commandline%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown