Batch script string parsing

March 31, 2009 at 12:45:12
Specs: Windows XP
I've got a batch script that runs through a file, but every time it hits a line with a less-than sign, it bombs. Here's the script:

REM Gets line from earlier
SET Line=%*
REM Remove quotes from the line
SET Line=%Line:"=%
REM Tests the line. This is in a loop.
IF "%Line:~0,6%"=="[HKEY_" FOR /F "tokens=5 delims=\]" %%A IN ('ECHO.%Line%') DO ECHO %Line%

It can parse through a file that contains stuff from a registry file, but when it runs across a line with a less-than sign, it complains, saying "less-than was unexpected at this time."

How can I get around that? How can I strip out the less-than signs like I can strip out the quotes?

See More: Batch script string parsing

Report •

March 31, 2009 at 18:56:40
how does the file that you are going to parse look like? and what is your final output look like?

Report •

April 1, 2009 at 08:55:53
Windows Registry Editor Version 5.00




"Models"="<models><model name= yadda yadda yadda Label=\"Model Dataset\" dataset-type=\"DVA\" optional=\"true\"/></model></models>


Report •

Related Solutions

Ask Question