简体   繁体   中英

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!

Use the standard parse-loop :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM