I am trying to to run mysql with input from a file. I have found that the following works:
cmd /c 'C:\Program Files\MySQL...\mysql -u user -pPassword databasename -f < inputfilename.sql'
The problem is that the databasename ($database) and inputfilename.sql ($file) are variables and need to be interpolated. I have not found any way to make the interpolation work.
Note that invoke-expression and & will not work because PowerShell doesn't implement < for input redirection.
Any suggestions?