echo off set PGPASSWORD= FOR /L %%A IN (1,1,5000) DO ( timeout 1 >nul "\psql" -h -p 5432 -U -d -t -f "PGQuery.txt" >> PGlog.txt 2>&1 )