Taken from here
To achieve an automated backup in a windows environment:
1. Create a .pgpass file
(I called mine pgpass.conf) and put it somewhere secure. I have it in a subdirectory under
the script that runs the backup.
pgpass contains host access information in this format
hostname:port:database:username:password
Lock down the .pgpass file
Using NTFS permissions, disable access to this file for everybody except the user pg is running as
(If you're running pg under the system account, then you should set it to use it's own user credentials)
2. Create a script to call pg_dumpall
For example:
SET PGPASSFILE=C:\foo\bar\PG_BACKUP\PGPASSFILE\pgpass.conf
"C:\Program Files\PostgreSQL\9.2\bin\pg_dumpall.exe" -U postgres_username > C:\foo\bar\PG_BACKUP\db.out current
The firstline is the location of your pgpass file. The second line is the pg_dumpall command which outputs your whole database to the file C:\foo\bar\PG_BACKUP\db.out
3. Create a scheduled task
The command is
C:\Windows\System32\cmd.exe /c "C:\foo\bar\PG_BACKUP\pg_backup.bat"
and it starts in the directory
C:\foo\bar\PG_BACKUP
Here's a good tutorial on how to create scheduled tasks on windows:
http://www.makeuseof.com/tag/how-to-automate-windows-programs-on-a-schedule/.
You can find plenty such tutorials and info with a simple search.