Get product name from WMIC for a variable in batch

后端 未结 1 1815
长发绾君心
长发绾君心 2021-01-14 08:41

I\'ve been struggling to get a specific output using WMIC in batch in order to build an automatic uninstall script. The issue I\'m running across is that the uninstaller for

相关标签:
1条回答
  • 2021-01-14 09:03

    EDIT.Turns out that % is needed to be used as wildcard

    @echo off
    for /f "skip=1 delims==" %%a in (
         'wmic product where "Name like '%%product-name%%'" get name /format:table'
    ) do (
       for /f "tokens=* delims=" %%# in ("%%a") do  set PROD=%%a
    ) 
    echo %PROD%
    

    it is explained here

    0 讨论(0)
提交回复
热议问题