【发布时间】:2015-03-19 17:11:16
【问题描述】:
我有一个要在批处理脚本中运行的 powershell 命令。它在 powershell 窗口中运行良好,但我无法在批处理脚本中正确调用它。 powershell 命令是这样的:
invoke-sqlcmd -inputfile "D:\Reports\sql.sql" -ServerInstance SERVER1 | export-csv "D:\Rpt\historical\sample1.csv" -Force -En UTF8
我希望有人可以帮助我。另外,是否可以包含批处理变量来替换输入和输出文件的文件路径,而不是将整个路径放在 powershell 命令中(仍然在批处理脚本中运行)?
谢谢。
【问题讨论】:
标签: windows powershell batch-file