This is the script I have created:
:start
@echo off
color 1f
:: SCRIPT BY STEALTH ::
:: License:
:: - You can modify and use this software for free
:: - You may not sell it or rent it!
:: Licensed under GNU Public License.
:: Variables by Stealth ::
REM Database Variables - SHOULD BE CHANGED
set host=localhost
set database=l2jdb
set user=root
set passw=
REM MySQL Variables
set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe
REM Path , Saving Variables
set SavePath=%cd%\
REM Loaded Variables
@echo #############################
@echo #Database Backup Script v1.0#
@echo #############################
@echo # Coded by Stealth #
@echo #############################
@echo.
@echo.
@echo Do you wish to make a backup?
set /p make=(y/n):
If %make%==y goto new_backup
If %make%==n goto mxc
goto start
:mxc
@echo Please take some time to visit:
@echo www.MaxCheaters.com
@echo.
@echo Do you wish to visit now?
set /p visit=(y/n):
If %visit%==y start www.maxcheaters.com
If %visit%==n exit
:new_backup
@echo Creating New Backup...
@echo Output directory: %SavePath%
@echo.
@echo Please specify a name for your backup:
set /p name=Backup Filename:
@echo.
@echo Saving...
%MySQLdumpPath% --add-drop-table -h %host% -u %user% --password=%passw% %database% > %name%.sql
@echo.
@echo File %name% created!
@echo.
Echo Thank you for using [Database Backup Script v1.0] by Stealth
echo.
echo Press a key to exit (Goodbye)...
pause>nul
exit
Copy it to file with .bat extension and your done!
- PS: Dont forget to set the variables:
set host=localhost
set database=l2jdb
set user=root
set passw=
set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe
Variables Explained:
set host=
The host pc that runs the database (default : localhost)
set database=
The database name (default : l2jdb)
set user=
Database username (default : root)
set passw=
The database password (default is blank or "root" without the quotes)
set MySQLdumpPath=%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysqldump.exe
The directory which has mysqldump.exe file (default for MySQL Server 5.1 is the one i entered)
Credits to me , and some code taken from database installers so credits also to L2JFree & TaneL
Compiled Batch Script:
http://www.4shared.com/file/90025800/db86bb4/Backup.html