How to use pg_archivecleanup on Windows
Automating the process is simple once you know what you want to delete.

I can give you a few hints:


Typically, you want to remove all WAL archives older than the oldest base backup which you want to retain.
Whenever a base backup is done, PostgreSQL will archive a file called *.backup.

You can use this file as the second argument to pg_archivecleanup to remove everything older than that backup.


So to retain the last three backups, you could look at all *.backup files, sort them by modification time and find the third youngest file, then use pg_archivecleanup with that file as second argument.