Redirection is a shell feature. Start-Process
will dutifully include the last argument with the database name and the >
in the actual argument passed to mysqldump
which in turn has no idea what to do with the >
at all.
You probably want something like
$args = '-u','databaseUser','-pMySuperAwesomePasswordHere','--single-transaction','--log-error=c:\backups\mysqldump_error.log',"$database"
& "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe" @args | Out-File $backupFilePath\$database.sql
Since mysqldump
is a console application it will wait anyway until it's done before continuing with the script.