command line - Using powercfg to duplicate the currently active power scheme -
I currently run a batch file with a series of powercfg commands to duplicate and rename an active plan the wanted.
Manually, I will do something like this at a command prompt.
powercfg -getteivescheme
This will present me the GUID active plan
powercfg-duplicatescheme & lt; Received GUID & gt; & Lt; New GUID & gt;
Ideally, I want to do something like this ...
powercfg -duplicatescheme -getctivescheme & lt; New GUID & gt;
But since this is not allowed, is there any other way?
OK, first you have to remove the GUID from the output of This will output to the GUID only, you can also save it in any variable: You can remove extra space from here (here I am a place in front You have a GUID, you can keep it now: In your command line above: You can only create a new GUID I need to think in the I do not know the included command line program which makes one for you. NB: Here the code (especially for the powercfg
Can be done with for
:
for
/f "tokens = 2 delims = :(" %% (in powercfg-getctivescheme ') x Copy %% x
For
/ f "tokens = 2 Delims = :( Set GUID = %% x in %% x ('powercfg -getiveschecheme')
set GUID =% GUID: =%
powercfg -duplicatescheme% guid% & lt; new GUID & gt;
part
part) assumes that you Do this in a batch file. Directly around the command line, you must use % x
instead of %%
in for
order.
Comments
Post a Comment