Sandy
Sandy

Reputation: 35

retrieve specific text from batch command output

I am trying to retrieve the version of my Mcafee DLP using a batch script.

reg query "HKEY_LOCAL_MACHINE\Software\McAfee\DLP\Agent" 

The above command gives the following output:

HKEY_LOCAL_MACHINE\Software\McAfee\DLP\Agent
    UNRSKIP    REG_SZ    skip
    AgentVersion    REG_SZ    10.0.100.372
    PackageType    REG_SZ    DLP
    CommonAppDataFolder    REG_SZ    C:\ProgramData\

How do i retrieve this line : AgentVersion REG_SZ 10.0.100.372

Upvotes: 0

Views: 884

Answers (1)

user2648008
user2648008

Reputation: 152

reg query "HKEY_LOCAL_MACHINE\Software\McAfee\DLP\Agent" | find "AgentVersion" > tmp.txt
for /F "tokens=3 delims= " %%f in (tmp.txt) do (echo %%f)

hope this helps !

Upvotes: 1

Related Questions