Reputation: 63
wmic nic where "netconnectionid like '%'" get netconnectionid
This code executes on the console properly but while i am trying to batch script like below script didn't execute. is there any suggestion? what is the correct escape charakters for below script?
Thanks.
@Echo Off
For /f "tokens=1*" %%a In ('wmic nic where "netconnectionid like '%'" get netconnectionid') Do (
Call :UseNetworkAdapter "%%a %%b"
)
Upvotes: 0
Views: 981
Reputation: 1470
As user stated, he found the solution by putting in the extra %, which is required inside a batch script (as opposed to being run interactively from the command prompt). See corrected code below. I'm posting this as an answer since, like Chuck Kollars stated above, doing so will stop this from showing up in "unanswered" lists. Also, as an SO newbie, I feel like being a Point Pimp tonight. :)
@Echo Off
For /f "tokens=1*" %%a In ('wmic nic where "netconnectionid like '%%'" get netconnectionid') Do (
Call :UseNetworkAdapter "%%a %%b"
)
Upvotes: 1