It is a fairly trivial thing to use a For loop with delims option to split a string.
The below is a batch script that reads itself for the information required.
Code: Select all
@Echo off
Set LF=^
:; above empty lines required for 'LF' linefeed definition.
:; Delayed expansion required to expand 'LF' variable
Setlocal EnableDelayedExpansion
For /f "Tokens=1,2 delims=#:" %%G in ('findstr /BC:":#" "%~f0"')Do Echo(Name: %%G!LF!Room Number: %%H
goto :eof
:#jonson:138
:#Massison:124
:#Elias:125
:#Ruby:118
To apply the same to your source file, modify the for loop like so:
( assuming only the desired information contains ':' )
Code: Select all
For /f "Tokens=1,2 delims=:" %%G in ('findstr /C:":" "YOURSOURCEDOCSPATH.EXT"')Do Echo(Name: %%G!LF!Room Number: %%H
As for the second part of your question, I find your intent and meaning to be unclear.
What is the use case / method by which the data is intended to be processed? Can you provide more detail on what steps you want to take with the information?