Created
April 10, 2017 10:48
-
-
Save alanljj/d518d22298aaab1e197f69584cdb1b96 to your computer and use it in GitHub Desktop.
Automated_Backup_Postgresql_on_Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do ( | |
set dow=%%i | |
set month=%%j | |
set day=%%k | |
set year=%%l | |
) | |
set datestr=%month%_%day%_%year% | |
echo datestr is %datestr% | |
set BACKUP_FILE=<NameOfTheFile>_%datestr%.backup | |
echo backup file name is %BACKUP_FILE% | |
SET PGPASSWORD=<PassWord> | |
echo on | |
bin\pg_dump -i -h <HostName> -p 5432 -U <UserName> -F c -b -v -f %BACKUP_FILE% <DATABASENAME> | |
rem from https://wiki.postgresql.org/wiki/Automated_Backup_on_Windows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment