I am having a hard time figuring out how to split a string (a path) by another string. I ave seen a few posts regarding this, however, people are always splitting using a single character like a '\' for example.
I need to specifically split this:
C:\abc\def\ghi\jkl\
by this:
def
so I get this: C:\abd\ and this \ghi\jkl\
And I need to be able to address both pieces. Basically, I need to find that foldername in a string, and it is NEVER in the same place in the path, otherwise I would just split by '\' and count up to that folder... cant do that. What I have now seems to search for each letter individually.
Any ideas? below is where i left off, trying to figure out how to put the foldername "project" after the delims part.
rem assuming %1 is flder dragged onto .bat file
for /f "tokens=1* delims=<foldername???>" %%a in ("%1") do (
set part1=%%a
set part2=%%b
)
echo part1 = %part1%
echo part2 = %part2%
Thanks for any help you can give!
Ken