Skip to content

Instantly share code, notes, and snippets.

@dylanj
Created February 27, 2018 18:39
Show Gist options
  • Save dylanj/4f4e157f7f0df8aad60c0b0a1e77760b to your computer and use it in GitHub Desktop.
Save dylanj/4f4e157f7f0df8aad60c0b0a1e77760b to your computer and use it in GitHub Desktop.
@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=pgdumptest_%datestr%.backup
echo backup file name is %BACKUP_FILE%
SET PGPASSWORD=test
echo on
pg_dump -h localhost -p 5432 -U postgres -F c -b -v -f c:\backups\%BACKUP_FILE% postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment