Hi,I have a batch file in which i need to call two other batches depending on a condition.
And the condition is, i have two variables in a text file(Two strings.For Eg:2016JanFcst and 2016FebFcst).Now i have two read these two variables from my batch and check if these two are equal.
And if these two variables are equal i have to call one batch else the other one.
Can anyone let me know how this can be achieved?
Variable comparision in a batch file
Moderator: DosItHelp
Re: Variable comparision in a batch file
Sample.txt
Code snippet:
Meerkat
Code: Select all
2016JanFcst
2016FebFcst
Code snippet:
Code: Select all
@echo off
(
set /p var1=
set /p var2=
)<"Sample.txt"
::Uncomment the next line just to make sure the two strings are captured...
::echo."%var1%" "%var2%"
if "%var1%"=="%var2%" (
call "Code1.bat"
) else (
call "Code2.bat"
)
Meerkat