PowerShell can call commandline batch files. PowerShell script output can be recorded with the "tee" command. But the tee command does not record the output of batch files inside a PowerShell script for me in PowerShell 1.
Try this cut-down example:
Make a batch file, called test.bat, with contents
@echo hello from bat
Run it from PowerShell:
PS C:\> .\test.bat | tee out.txt
This works - You will have an output file, containing
hello from bat
Now make a PowerShell script called test.ps1 that wraps the batch file, containing
write-output "hello from PS"
.\test.bat
Now run this with a tee:
.\test.ps1 | tee pout.txt
This does not record the output of the batch files - the output file contains only
hello from PS
Whereas I expected
hello from PS
hello from bat
But no batch output is captured. How can I capture the output of this PowerShell script and subordinate batch files?