Question

How can I use if else statement to echo if value more than 1?

@echo off

setlocal
set "sql=c:\xampp\mysql\bin\mysql.exe"
for /f "usebackq" %%a in (`%sql% -u root -ss -e "select COUNT(*) FROM mytable"      mydatabase`) do set TESTVAR=%%a

if %TESTVAR% GEQ 1 (echo Database has already existed.) else echo import 

pause
Was it helpful?

Solution

Kind of like this:

@echo off
setlocal
set "sql=c:\xampp\mysql\bin\mysql.exe"
for /f "usebackq" %%a in (`%sql% -u root -ss -e "select COUNT^(*^) FROM browser" form_generator`) do set TESTVAR=%%a
if %TESTVAR% LSS 1 echo whatever
pause
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top