I am using this batch file to backup my database:
@echo off
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
set dow=%%i
set month=%%j
set day=%%k
set year=%%l
)
for /f "tokens=1-2 delims=/:" %%a in ('time /t') do (
set time=%%a%%b
)
set datestr=%month%_%day%_%year%_%time%
echo datestr is %datestr%
set BACKUP_FILE=C:\database_files\db_backup\DailyBackup_%datestr%.backup
echo backup file name is %BACKUP_FILE%
SET PGPASSFILE=C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf
echo on
"C:\Program Files\PostgreSQL\9.0\bin\pg_dump" -i -h localhost -p 5432 -U postgres -F c -b -v -f %BACKUP_FILE% databasename
When I run it I get the error mentioned in the title. If i remove the part where I set the name of the file to include the time, it works.