如果值大于1,我如何使用if else语句来回显?
@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
答案 0 :(得分:2)
有点像这样:
@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