How do I extract everything between incno and the space ie12345678 in the example batch below and put it into a incno variable?
@echo off
Set mystring=test incno12345678 wo5555 locFred Street
Echo "my string=%mystring%"
Echo incno
Echo wo
Echo loc
The incno can be 8 to 11 digits long but will always be between incno and a space in the string
I am now having trouble assigning the %%d variable to the mystring variable now it is in a for loop. Can anyone help me with this? See Below.
@echo off
SETLOCAL enableDelayedExpansion
color 0B
For /d %%d in ("C:\Users\%Username%\LocalData\*") do (
Echo "Folder = %%d"
Set mystring=%%d
echo "MyString = %mystring%"
pause
REM delete until (including) "incno":
set mystring=%mystring:*incno=%
echo %mystring%
REM delete starting with (including) " ":
set mystring=%mystring: =&rem %
echo "Incident Number = %mystring%"
pause
)