Create a batch file containing a command for the Access executable, followed
by the path to the database you want to compact, then the /compact switch.
For example:
"C:\Program Files\Microsoft Office\Office 11\MSAccess.exe" C:\Work\Work.mdb
/compact
Quotes are required if the path name contains spaces. After you create the
batch file, just use Windows task scheduler to schedule execution. You'll
want to make sure it's at a time when no one is using the database,
obviously. The /compact switch defaults to keeping the file name the same,
so if you want to rename it, you'll have to type the new path and file name
after the switch.
For a complete list of switches and their uses, do a search in Access help
for "startup command-line options".