想定シナリオ:
ファイルからコマンドを取得して実行し、結果をファイルに書き込む
# テスト用ファイル作成
$f1 = "H:\tmp\a.txt"
$f2 = "H:\tmp\a.log"
Write-Output 'mysql -uroot -p"password" -D test --skip-column-names -e "select now();"' | Out-File -FilePath $f1
Write-Output 'mysql -uroot -p"password" -D test --skip-column-names -e "show tables;"' | Out-File -FilePath $f1 -Append
Write-Output 'mysql -uroot -p"password" -D test --skip-column-names -e "show create table tab1 \G"' | Out-File -FilePath $f1 -Append
Get-Content -Path $f1
# OSコマンド実行
Get-Content -Path $f1 | Invoke-Expression | Set-Content $f2