Find quoted value from xml file

September 22, 2016 at 12:22:32
Specs: Windows 64
Hey! So I've got the following in an xml file:

<addon id="plugin.whatever" name="Whatever" version="0.0.0" provider-name="someone">

I need to store/echo the value between quotes in id and version.

I assume it would be something like this:
for /f "tokens=3 delims=<>" %%a in ('find "<addon id="" ^< "addon.xml"') echo "%%a"

but I have no idea how to use find tokens and the like.

Any help would be greatly appreciated!

See More: Find quoted value from xml file

Reply ↓  Report •

September 22, 2016 at 20:43:03
You're very close. Delims clause cannot use " as far as I know. So that leaves us with this kludge:
@echo off & setlocal
for /f "tokens=3,7 delims== " %%a in ('find "<addon id="" ^< "addon.xml"') do (
echo %%~a
echo %%~b
::======= end snip
may not work. only marginally tested.

Reply ↓  Report •

September 25, 2016 at 08:44:30
Sadly, that isn't doing anything. Script completes, but output is blank.

Reply ↓  Report •

Related Solutions

Ask Question