Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch script string parsing
Name: WebMonk Date: March 31, 2009 at 12:45:12 Pacific OS: Windows XP Subcategory: Batch
Comment:
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?
[HKEY_LOCAL_MACHINE\Software\yeahyeah] "Models"="<models><model name= yadda yadda yadda Label=\"Model Dataset\" dataset-type=\"DVA\" optional=\"true\"/></model></models>
Summary: The following returns each word in a For controlled loop For /F "tokens=*" %%I in ('FindStr /C:"TestString" File.txt') Do Call :PARSE %%I .... .... GoTo :EOF :PARSE If "%1"=="" GoTo :EOF Echo %1 Shift...
Summary: I'm having a little trouble with parsing strings in batch. Basically, I'm trying to make a batch script to automatically compile and run Java files, and make that script the default program for .java...
Summary: I have a list of computer serial numbers and their corresponding asset tags (taglist.txt). The list can be arranged any way to make this task easier (two columns separated by spaces/tabs, one column w...