xAphex
xAphex

Reputation: 53

How to parse the command output in batch file

i'm creating a batch file to show my current power plan i'm using this command:

powercfg -getactivescheme

it shows the result like this:

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)

i want to hide the power plan code so it only shows:

(High performance)

any help is appreciated :D thanks!

Upvotes: 5

Views: 11478

Answers (1)

woxxom
woxxom

Reputation: 73586

Use the standard parse-loop:

for /f "delims=() tokens=2" %%a in ('powercfg -getactivescheme') do set name=%%a
echo Name: (%name%)

Upvotes: 6

Related Questions