SystemInfo - Get computer System Model via CMD - Extra spaces bug

后端 未结 3 1389
抹茶落季
抹茶落季 2021-01-29 01:17

I\'m trying to get a Computer System Model type via Batch file. for this i\'ve created this script:

systeminfo | find \"System Model\" > %temp%\\TEMPSYSINFO.t         


        
3条回答
  •  醉话见心
    2021-01-29 01:23

    You're doing it the hard way. Use wmic. It's a lot faster and less complicated to scrape.

    for /f "tokens=2 delims==" %%I in ('wmic computersystem get model /format:list') do set "SYSMODEL=%%I"
    set "Line1=*** System Model: %SYSMODEL%"
    echo %Line1%
    

    wmic lets you query all sorts of neat wmi garbage. wmic /? for more info.

    (updated per OP's comment under Fuzzy Button's answer)

提交回复
热议问题