Copyright: Hello, Bug https://blog.csdn.net/AdminPwd/article/details/89884643
1. First, create a text document
@ECHO OFF
@setlocal enableextensions
@cd /d "%~dp0"
set PGPASSWORD=111111
SET PGPATH=D:\postgresql\PostGreSql\PostgreSQL\10\bin\
SET SVPATH=E:\DataBaseTablespace\
SET PRJDB=DB
SET DBUSR=user
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"
Which are to be changed, as shown:
and After modifying, the name suffix .bat
2. Create a window and then began to plan the timing
to open the Control Panel - System and Security - Administrative Tools - Task Scheduler
can also enter in my computer this can also be found ==> Control Panel \ System and Security \ management tool
open so the
step
Then click the fool, and finally
click Finish to create complete
I start back up