WMIC query in for loop
Posted: 04 Oct 2014 18:21
Hi,
By running the following query, I get my response with headers (IPAddressName and InstanceName) which I want to eliminate
wmic /NameSpace:\\root\Microsoft\SqlServer\ComputerManagement11 Path ServerNetworkProtocolProperty where (PropertyName='IPAddress' or IPAddresName='IPAll') get IPAddressName, InstanceName
so I am running the following
for /f "skip=1 tokens=1,2 delims= " %a in ('wmic /NameSpace:\\root\Microsoft\SqlServer\ComputerManagement11 Path ServerNetworkProtocolProperty where ^(PropertyName^='IPAddress' or IPAddressName^='IPAll') get InstanceName^, IPAddressName'^) do @echo %a %b
but I am getting error (get was unexpected at this time)
What I am doing wrong?
By running the following query, I get my response with headers (IPAddressName and InstanceName) which I want to eliminate
wmic /NameSpace:\\root\Microsoft\SqlServer\ComputerManagement11 Path ServerNetworkProtocolProperty where (PropertyName='IPAddress' or IPAddresName='IPAll') get IPAddressName, InstanceName
so I am running the following
for /f "skip=1 tokens=1,2 delims= " %a in ('wmic /NameSpace:\\root\Microsoft\SqlServer\ComputerManagement11 Path ServerNetworkProtocolProperty where ^(PropertyName^='IPAddress' or IPAddressName^='IPAll') get InstanceName^, IPAddressName'^) do @echo %a %b
but I am getting error (get was unexpected at this time)
What I am doing wrong?