I need to get an output of active databases. For that i have writen the following code in suchaway that if the 4th line executes with out any error i'll echoed it as "Active" or "InActive".But in the following code for loop is executing once and skipping the rest of the iterations..
Please help me with this.
Code: Select all
@echo off
Setlocal EnableDelayedExpansion
For /F "tokens=*" %%a In ('mysql --user=%1 -p%2 -N -s -e "show databases"') do ( echo.skipped skipped
mysql --user=%1 -p%2 --database=%%a -N -s -e "show tables">NUL 2>&1
if ERRORLEVEL 1 (echo.%%a InActive ) else (echo.%%a Active)
)
Output :
information_schema Active
skipped skipped
skipped skipped
skipped skipped