我希望能够从批处理文件中运行以下命令:
现在我想将进程的输出记录到文件中,我发现使用PowerShell非常方便。
"C:\OpenCover\tools\OpenCover.Console.exe" -register:user -target:"%VS110COMNTOOLS%..\IDE\mstest.exe" -targetargs:"/testcontainer:\"C:\Develop\bin\Debug\MyUnitTests.dll\" ... "
PAUSE
现在我想将进程的输出记录到文件中,我发现使用PowerShell非常方便。
powershell "dir | tee output.log"
但这并不会将我的批处理文件作为第一个参数(powershell "my.bat | tee output.log"
),因为它不是cmdlet、函数或脚本文件的名称。
我可以更改我的批处理文件,使其变为 powershell "OpenCover.Console.exe..."
但我需要适应所有引号并更改转义字符等等。
有没有办法让批处理文件在powershell中执行?或者有没有办法在某个powershell命令之后直接插入我的未经修改的行,并且它会“像应该的那样”全部执行?