Excuse me. I would like to state some aclarations about this topic.
You have not indicated where your "array" come from. You may store it in a variable, for example:
set dirs=directoryA directoryB directoryC directoryD directoryE directoryF
However, this is not an array, but a list. You may create this list from the parameters of a subroutine this way:
set dirs=%*
If you want to remove the first three elements from this list, you may do that this way:
for /F "tokens=3*" %%a in ("%dirs%") do set dirs=%%b
Another possibility is that the directories were passed to a subroutine as a parameters list:
call :subroutine directoryA directoryB directoryC directoryD directoryE directoryF
I think this is the case based on your example. In this case it is very easy to "remove" the first three parameters via three shift
commands:
:subroutine
rem Remove first three parameters:
shift
shift
shift
rem Process the rest of parameters:
:nextParam
if "%1" equ "" goto endParams
echo Next param is: %1
shift
goto nextParam
:endParams
However, if you have a "real" array (with numeric subscripts that start at 1) that may also be created from the parameters list for a subroutine this way (like in your example):
set paramCount=0
for %%x in (%*) do (
set /A paramCount+=1
set "dirs[!paramCount!]=%%x"
)
Then you may remove the first three elements this way:
for /L %%i in (4,1,%paramCount%) do (
set /A j=%%i-3
set dirs[!j!]=!dirs[%%i]!
)
set /A paramCount-=3