I have a Powershell command that I want to be run in a batch script. It works well in the Powershell console, but I cannot call it properly in batch script. The Powershell command goes like this:
invoke-sqlcmd -inputfile "D:\T3 Reports\sql.sql" -ServerInstance ISD-DB02 | export-csv "D:\T3RawDataFiles\T3HistoricalRaw\Complaint\samp.csv" -Force -En UTF8
Why doesn't this command work in a batch script?
Also, is it possible to use a batch variable in place of the file path for input and output file instead of putting the whole path in the Powershell command (still run inside in batch script)?
Thanks.