Here is a windows cmd fragment:
:moveFiles
@for /f %%R in ('dir /b current') do (
@echo ___
@echo Moving %%R to FTP server.
%java_cmd% -jar f17ftp.jar -dput -file:%%R %select%
if 1 neq 0 (
@echo Transfer of %%R failed.
call :readLog
echo %log%
%java_cmd% -cp SQLQueryXML.jar com.saliencrgt.chums.AlertMessage "Contents of ftp log are:<br/><br>"%log%
) else (
@echo Transfer of %%R succeeded.
move current\%%R xmlfiles 1> nul
)
)
exit /b
:readLog
setlocal enableextensions enabledelayedexpansion
@for /F "delims=" %%x in (f17ftp.debug.log) do (
if .!build!==. (set build=%%x) else (set build=!build!,%%x)
)
endlocal & set log=!build!
exit /b
I am trying to get the contents of a file into a variable to send as an argument to a java class The readLog function does read the file and if I echo !build! prior to the endlocal the file contents do print to the console.
I can set "log" to a constant instead of the !build! variable and I see it in the calling function, but I can't get the delayed variable value out of the function.