Reputation: 12880
The user input parameter is not getting set into checkoutdir
variable.
@echo off
echo.
echo. [ SVN Updater ]
setlocal enableDelayedExpansion
set SOURCE=E:\Svncheckout\21MAY2016\
set SVN=C:\Program Files\TortoiseSVN\bin
set SVN_REPO_URL=https://192.168.1.35:8443/svn/
set projects=JPO/JPOMobile/branches/2016-05-18 JPO/JPOWEB/branches/20160518
(for %%i in (%projects%) do (
echo. Going to repository - %%i
echo. Please provide checkoutdir name
set /p checkoutdir=
echo. Checking out %SVN_REPO_URL%%%i from SVN...
"%SVN%\TortoiseProc.exe" /command:checkout /path:"%SOURCE%%checkoutdir%" /url:"%SVN_REPO_URL%%%i" /closeonend:2
)
)
echo.
echo. Operation complete.
Problem :
The checkoutdir
is set to the projects directory name
For first iterarion, it is set to 2016-05-18
that results to path in E:\Svncheckout\21MAY2016\2016-05-18
. For second iteration, it is set to 20160518
that results to path in E:\Svncheckout\21MAY2016\20160518
Upvotes: 0
Views: 30
Reputation: 49086
This code should work:
@echo off
echo.
echo. [ SVN Updater ]
setlocal EnableDelayedExpansion
set "SOURCE=E:\Svncheckout\21MAY2016\"
set "SVN=%ProgramFiles%\TortoiseSVN\bin"
set "SVN_REPO_URL=https://192.168.1.35:8443/svn/"
set "projects=JPO/JPOMobile/branches/2016-05-18 JPO/JPOWEB/branches/20160518"
for %%i in (%projects%) do (
echo. Going to repository - %%i
echo. Please provide checkoutdir name
set /p "checkoutdir=Directory name: "
echo. Checking out %SVN_REPO_URL%%%i from SVN...
"%SVN%\TortoiseProc.exe" /command:checkout /path:"%SOURCE%!checkoutdir!" /url:"%SVN_REPO_URL%%%i" /closeonend:2
)
echo.
echo. Operation complete.
endlocal
It is necessary to reference a variable with delayed expansion using exclamation marks instead of percent signs after enabling delayed expansion.
Open a command prompt window, run set /?
and read all output pages.
The environment variables referenced with percent signs are always expanded on parsing the command line respectively the command block defined with (
... )
.
Upvotes: 1