PostgreSQL automatically backs up and deletes Windows scripts for backup files 10 days ago.
The first step, create the script, name the Back.bat file
@ECHO OFF
@setlocal enableextensions
@cd / d "% ~ dp0"
set PGPASSWORD = password
SET PGPATH = D: \ postgresql \ bin \
SET SVPATH = d: \ zoobackup \
SET PRJDB = gzzoo
SET DBUSR = postgres
FOR / F "TOKENS = 1,2,3 DELIMS = /" %% i IN (‘DATE / T’) DO SET d = %% i-%% j-%% k
SET DBDUMP =% PRJDB% _% d% .bak
@ECHO OFF
% PGPATH% pg_dump -h localhost -U postgres% PRJDB%>% SVPATH %% DBDUMP%
echo Backup Taken Complete% SVPATH %% DBDUMP%
forfiles / p% SVPATH% / d -5 / c "cmd / c echo deleting @file ... && del / f @path"
Among them: PGPASSWORD password, PGPATH database path, SVPATH backup file storage location, PRJDB database name, DBUSR user name
Step 2 Set up scheduled tasks
https://www.cnblogs.com/franknihao/p/7120851.html
Windows postgresql regular backup, no need to manually enter the password