Set variable depends on if
Posted: 06 Aug 2010 07:17
Hello everybody,
Why this variable doesn't work?
Thanks
Why this variable doesn't work?
Code: Select all
@ECHO OFF
SET AA=******************
SET C1=THIS IS THE RIGHT LINE
SET C3=.................
set cnt_record=1
set rec_tot=2
CALL :check
GOTO:EOF
:check
IF %rec_tot% NEQ %cnt_record% (
SET C1=WRONG LINE
SET E1=WRONG RECORDS %cnt_record%
SET E2=WRONG RECORDS %rec_tot%
ECHO.%AA% >> E:\output.txt
ECHO.%C1% >> E:\output.txt
ECHO.%E1% >> E:\output.txt
ECHO.%E2% >> E:\output.txt
) ELSE (
ECHO.%AA% >> E:\output.txt
ECHO.%C1% >> E:\output.txt
ECHO.%C3% >> E:\output.txt
)
GOTO:EOF
Thanks