How can i parse string using batch script?
Goal is to save in a array everything under Import: and strip out "#head" for example --> "//MPackages/Project/config/abc.txt" and "//Packages/Project/config/cde.txt"
test.txt
Version: 4.5.0
Import:
//MPackages/Project/config/abc.txt #head
//Packages/Project/config/cde.txt #head
View:
//MPackages/Project/config/ac.txt #head
//Packages/Project/config/de.txt #head
MY try
@echo off
set buildlog="devel.p4inc"
setlocal EnableDelayedExpansion
for /F "tokens=*" %%A in (devel.p4inc) do (
if /i "%%A"=="Import:" set "import=true"
IF DEFINED import (echo %%A)
)
for /floop, beginning capture of the first token of each line until the first 2 characters of token 1 is no longer//?if /i "%%I"=="Import:" set "import=true"and begin capturing on the next loop iteration. Thenif defined import if not "!variable:~0,2!"=="//" goto nextto break out of the loop. Show what you've tried so far and you'll get answers.