I'm not sure the best way to go about doing this...
Ultimately I want to run a MySQL query and run that into a DOS FIND command...from that point, I want to be able to "do" something with the output. Perhaps with an IF statement.
This is what I had in mind:
SET MYSQLOUTPUT=mysql.exe -uroot -ppassword --execute="use db_name;select field from table;"
%MYSQLOUTPUT% | find "string"
After this point is where I'm stuck...
I'd like to be able do something like "IF this string is found...DO this...or goto another function"
IF statement with FIND
Moderator: DosItHelp
Re: IF statement with FIND
Should be something like this:
Code: Select all
for /f "delims=" %%a in ('mysql.exe -uroot -ppassword --execute^="use db_name^;select field from table^;"') do set "MYSQLOUTPUT=%%a"
echo %MYSQLOUTPUT%|find "string" >nul && (
rem DO this
) || (
rem goto another function
)