victortay
victortay

Reputation: 1

Copy-item with File-Out parameter

Copy-item -Force -Verbose -Recurse $sourceDirectory -Destination $destinationDirectory |
Out-File -FilePath D:\victor.txt

I do not know why it doesn't copy the output of the PowerShell to the text file. Will appreciate if someone can help thanks!!

Upvotes: 0

Views: 719

Answers (1)

drifter213
drifter213

Reputation: 109

You can use this to capture all output and redirect it to a file:

Copy-item -Force -Verbose -Recurse $sourceDirectory -Destination $destinationDirectory *> D:\victor.txt

*   All output  
1   Success output  
2   Errors  
3   Warning messages  
4   Verbose output  
5   Debug messages

Upvotes: 1

Related Questions