I am using the below to see a folder structure but when i look at the transcript a chunk of the resuts have been cut off from the top - as if it is starting halfway through
Start-Transcript -Path "C:\transcripts\transcript.txt"
tree /f
Stop-Transcript
CodePudding user response:
I get the same behavior with tree /f
from a large directory tree. I don't know what is happening at this point, but I can offer a workaround:
tree /f 2>&1 | Tee-Object -FilePath treeOutput.txt
You could also do the following, if you don't need to output to the console at the same time:
tree /f 2>&1 > treeOutput.txt
As for the issue with tree /f
, tree
is actually tree.com
, not tree.exe
, which means it actually runs in an MS-DOS subsystem. I suspect that Start-Transcript
isn't fully compatible with .COM
programs and I suggest using output redirection as recommended above as a suitable workaround.