foreach ($f in Get-ChildItem -path "C:Usersi-infoDesktopSQLQuery" -Filter *.sql )
{
write-host $f.fullname
$out = "C:Usersi-infoDesktopSQLQueryOutput.txt" ;
invoke-sqlcmd -InputFile $f.fullname -Database "DBNAME" -ServerInstance "SERVERNAME" | format-table | out-file -filePath $out
}