I am trying to use the FIXED_LENGTH variable within a FOR loop.
Using the length of the string directly in the loop results in correct result, however trying to use the variable does not work. Any ideas?
Snippet that provides correct result
SETLOCAL ENABLEDELAYEDEXPANSION
REM Loop through the input file and read each line.
FOR /F %%G IN (SVN_URLs_List.txt) DO (
    SET CUR_LINE=%%G
    REM Make sure the variable CUR_LINE is surrounded with ! instead of % to ensure delayed variable expansion.
    @ECHO Processing the line: !CUR_LINE!
    REM Set fixed length of "https://projects.abcdefg.com/subversion/"
    SET FIXED_LENGTH=40
    REM Get the sub-string of CUR_LINE to get the folder name.
    SET FOLDER_NAME=!CUR_LINE:~40!
    @ECHO !FOLDER_NAME!
)
ENDLOCAL
Snippet that does NOT produce correct result:
SETLOCAL ENABLEDELAYEDEXPANSION
REM Loop through the input file and read each line.
FOR /F %%G IN (SVN_URLs_List.txt) DO (
    SET CUR_LINE=%%G
    REM Make sure the variable CUR_LINE is surrounded with ! instead of % to ensure delayed variable expansion.
    @ECHO Processing the line: !CUR_LINE!
    REM Set fixed length of "https://projects.abcdefg.com/subversion/"
    SET FIXED_LENGTH=40
    REM Get the sub-string of CUR_LINE to get the folder name.
    SET FOLDER_NAME=!CUR_LINE:~!!FIXED_LENGTH!!!
    @ECHO !FOLDER_NAME!
)
ENDLOCAL
I have tried
SET FOLDER_NAME=!CUR_LINE:~!!FIXED_LENGTH!!!
SET FOLDER_NAME=!CUR_LINE:~!FIXED_LENGTH!!
SET FOLDER_NAME=!CUR_LINE:~%FIXED_LENGTH%!
The input in the SVN_URLs_List.txt looks like:
https://projects.abcdefg.com/subversion/svnrepo1
https://projects.abcdefg.com/subversion/svn_repo_2
https://projects.abcdefg.com/subversion/another repo 3
I am expecting result:
svnrepo1
svn_repo_2
another repo 3
The first snippet produces right results. However using the second snippet produces something like:
https://projects.abcdefg.com/subversion/svnrepo1FIXED_LENGTH
https://projects.abcdefg.com/subversion/svn_repo_2FIXED_LENGTH
https://projects.abcdefg.com/subversion/another repo 3FIXED_LENGTH