Multiple FOR LOOP
Posted: 09 Apr 2010 08:46
Hi
I've go 2 FOR LOOP.
The Batch do the first loop only one time and pass automatically to the second.
Do you know why? Where is the mistake?
@echo off
REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION
SET ELS_DRIVE=%ELSHOMEDIRECTORY%\Test
SET SPOOLTV=%ELS_DRIVE%\SpoolTV
SET MATHRES=%ELS_DRIVE%\MathRes
SET FILE_IOP=InvestmentOrderProtocol
SET FILE_NOTICE=Notice_
SET FILE_MATHRES=MathRes
SET FILE_SUFFIX=.ps
SET SPOOLEDSTUFFTV=%ELS_DRIVE%\SpooledStuffTV
SET PRINTER_IP=%PRINTER_IP%
SET PRINTER_DESCRIPTION=%PRINTER_DESCRIPTION%
rem TODAY
SET dd=%DATE:~0,2%
SET mm=%DATE:~3,2%
SET yyyy=%DATE:~6,4%
rem SET dd=dd
rem SET mm=mm
rem SET yyyy=yyyy
REM Verify if SpooledStuff directory exist, if not exist create a new directory tree
IF NOT EXIST %SPOOLEDSTUFFTV%\%yyyy% mkdir %SPOOLEDSTUFFTV%\%yyyy%
IF NOT EXIST %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm% mkdir %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
echo %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
%ELS_DRIVE%
cd %SPOOLTV%
echo.
echo Convertering PostScript Document
%ELS_DRIVE%\EverlastingLibrary\Tools\PSConverter %SPOOLTV%
echo.
echo PSConverter post
echo.
echo ------------ Print Invest Order Portfolio File
for %%i in (%FILE_IOP%*%FILE_SUFFIX%) do CALL :FILE_IOP %%i
:FILE_IOP
SET myTempFile=%1
IF "%myTempFile%"=="" GOTO:FILE_NOTICE_PART
echo.
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
echo Printed 2 copies of: %myTempFile%
echo Move file %myTempFile% to %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
move /Y %SPOOLTV%\%myTempFile% %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
:FILE_NOTICE_PART
echo.
echo ------------ Print Notice File
for %%i in (%FILE_NOTICE%*%FILE_SUFFIX%) do CALL :FILE_NOTICE %%i
:FILE_NOTICE
SET myTempFile=%1
IF "%myTempFile%"=="" GOTO:EOF
echo.
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
echo Printed 2 copies of: %myTempFile%
echo Move file %myTempFile% to %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
move /Y %SPOOLTV%\%myTempFile% %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
I've go 2 FOR LOOP.
The Batch do the first loop only one time and pass automatically to the second.
Do you know why? Where is the mistake?
@echo off
REM -- Prepare the Command Processor --
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION
SET ELS_DRIVE=%ELSHOMEDIRECTORY%\Test
SET SPOOLTV=%ELS_DRIVE%\SpoolTV
SET MATHRES=%ELS_DRIVE%\MathRes
SET FILE_IOP=InvestmentOrderProtocol
SET FILE_NOTICE=Notice_
SET FILE_MATHRES=MathRes
SET FILE_SUFFIX=.ps
SET SPOOLEDSTUFFTV=%ELS_DRIVE%\SpooledStuffTV
SET PRINTER_IP=%PRINTER_IP%
SET PRINTER_DESCRIPTION=%PRINTER_DESCRIPTION%
rem TODAY
SET dd=%DATE:~0,2%
SET mm=%DATE:~3,2%
SET yyyy=%DATE:~6,4%
rem SET dd=dd
rem SET mm=mm
rem SET yyyy=yyyy
REM Verify if SpooledStuff directory exist, if not exist create a new directory tree
IF NOT EXIST %SPOOLEDSTUFFTV%\%yyyy% mkdir %SPOOLEDSTUFFTV%\%yyyy%
IF NOT EXIST %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm% mkdir %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
echo %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
%ELS_DRIVE%
cd %SPOOLTV%
echo.
echo Convertering PostScript Document
%ELS_DRIVE%\EverlastingLibrary\Tools\PSConverter %SPOOLTV%
echo.
echo PSConverter post
echo.
echo ------------ Print Invest Order Portfolio File
for %%i in (%FILE_IOP%*%FILE_SUFFIX%) do CALL :FILE_IOP %%i
:FILE_IOP
SET myTempFile=%1
IF "%myTempFile%"=="" GOTO:FILE_NOTICE_PART
echo.
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
echo Printed 2 copies of: %myTempFile%
echo Move file %myTempFile% to %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
move /Y %SPOOLTV%\%myTempFile% %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
:FILE_NOTICE_PART
echo.
echo ------------ Print Notice File
for %%i in (%FILE_NOTICE%*%FILE_SUFFIX%) do CALL :FILE_NOTICE %%i
:FILE_NOTICE
SET myTempFile=%1
IF "%myTempFile%"=="" GOTO:EOF
echo.
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
lpr -S %PRINTER_IP% -P "%PRINTER_DESCRIPTION%" %myTempFile%
echo Printed 2 copies of: %myTempFile%
echo Move file %myTempFile% to %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%
move /Y %SPOOLTV%\%myTempFile% %SPOOLEDSTUFFTV%\%yyyy%\%yyyy%.%mm%