FOR loop in .bat script is not running

September 3, 2010 at 07:30:54
Specs: Windows XP
Hi,

@ECHO OFF
SET ESS_SERVER=a
SET ESS_USER=b
SET ESS_PASSWORD=cc
SET ESS_APP=Pln
SET ESS_DB=Plndb
SET JOBNAME2=Refresh_User_Type
echo Running MaxL Script....
FOR /F "usebackq EOL= TOKENS=* DELIMS= " %%i IN (output.txt) DO (
SET USER=%%i
SET MXL_CMD=essmsh .\Mxl\%JOBNAME2%.msh %ESS_SERVER% %ESS_USER% %ESS_PASSWORD% %ESS_APP% %ESS_DB% %JOBNAME2% %USER%
)
ECHO Running %MXL_CMD%
%MXL_CMD%
IF NOT %ERRORLEVEL%==0 GOTO ErrHandler

In the above script i'm trying to extract the first column from the output.txt file. The content of output.txt is,

Line 1 ---> display user all
Line 2
Line 3 ---> User desc
Line 4 ---> ------- ------------
Line 5 ---> rehar cust
6 --> poggyu privileged
7 --> libbt priority

so,based on the FOR loop i'm using in the script i want,the user listed above to be assigned to the variable "USER"
For EG: In first iteration : USER = 'rehar'
In second iteration : USER = 'poggyu'
In third iteration : USER = 'libbt'


Please help me out on where i'm going wrong in the above .bat script.

Thanks!!

Rev


See More: FOR loop in .bat script is not running

Report •

#1
September 4, 2010 at 00:50:29
For loop:

for /f "skip=4 tokens=1" %%1 in (output.txt) do (
set user= %%1
..
..
etc...
)


Report •
Related Solutions


Ask Question