Click here to Skip to main content
15,881,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an mysql script (test.sql) which I run from the batch(all.bat)

test.sql looks like
CREATE TABLE Persons111 (
    PersonID int,
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City int
);	

CREATE TABLE City(
    City_Id int,
    Name varchar(255)
);	


all.bat looks like
C:\wamp\bin\mysql\mysql5.6.17\bin\mysql.exe -u root < test.sql


I wish to log the script execution result in html file.

Can anyone help me on this ?

What I have tried:

I googled and found this but could not relate it with my batch


@echo off
set lst=E:\Bat\all.bat
set opt=E:\Bat\output.html

if exist %lst% goto Label1

echo.
echo Cannot find %lst%
echo.
Pause
goto :eof

:Label1
echo ^<html^> > %opt%
echo ^<br^> >> %opt%
echo Ping Test STARTED on %date% at %time% >> %opt%
echo ^<br^> >> %opt%
echo ================================================= >> %opt%
echo ^<br^> >> %opt%
for /f %%i in (%lst%) do call :Sub %%i
echo ================================================= >> %opt%
echo ^<br^> >> %opt%
echo ^</font^> >> %opt%
echo Ping Test ENDED on %date% at %time% >> %opt%
echo ^</html^> >> %opt%
explorer %opt%
goto :eof
:Sub
echo Testing %1
set state=OK
ping -n 1 %1
rem if errorlevel 1 set state="^<font color=red>DOWN^</font>"
if errorlevel 1 set state="<font color=red>DOWN</font>"
echo %1 is %state% >> %opt%
echo ^<br^> >> %opt%
Posted
Updated 28-Dec-17 22:13pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900