Tag Archives: bat

MySQL database auto backup on windows

To backup mysql database (all databases) can use this batch file

Then you can compile the .bat file to become .exe file so that the password is hidden.

Download bat to exe converter from CNET download

Lastly, you can include the exe file to run in task scheduler

You can have option to upload the file via FTP to other server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
:: Start FTP files to remote server
:: Create the temporary FTP script file
> script.ftp ECHO ftpusername
>>script.ftp ECHO ftppassword
>>script.ftp ECHO lcd /
>>script.ftp ECHO lcd /MySQLBackups/backupfiles
>>script.ftp ECHO binary
>>script.ftp ECHO prompt n
>>script.ftp ECHO put FullBackup.%backupdate%.zip
>>script.ftp ECHO bye
:: Use the temporary script for unattended FTP
:: Note: depending on your OS version you may have to add a '-n' switch
FTP -v -s:script.ftp ftphostcom.com
:: Overwrite the temporary file before deleting it
TYPE NUL >script.ftp
DEL script.ftp
:: DONE FTP backup file to remote server

Sync with nist time during windows startup

I have problem with my old PC. The battery is not working anymore. So time is not saved when PC is off. This is alternative for me to keep the PC time up to date by sync the time with nist time during start up.

First you need to set the nist time in your time setting.
– double click the time on bottom left
– choose internet time
– check the “Automatically synchronize with …”
– choose time.nist.gov from the drop down
– press ok

Create a batch file (.bat) that contains this command
w32tm /resync

and save it in C: (e.g. timesync.bat)

Create short cut of the file in your Start > All programs > Startup

With this every time your computer is turned on, your PC local time will be synced with nist internet time.