Reputation: 75
The following line of my code simply does not write to file the Out-File
command:
Move-Item $item.Path $CaminhoCompleto -Force -WhatIf -Verbose |
Out-File -Filepath $SaidaTXT -Append -NoClobber
On the screen it shows correctly, but the file is empty.
Upvotes: 0
Views: 1939
Reputation: 200293
-WhatIf
messages are written directly to the console and can't be piped or redirected without running the statement in a different PowerShell process. You can capture the output with Start-Transcript
, though.
Start-Transcript -Path $SaidaTXT -Append
Move-Item ...
Stop-Transcript
Upvotes: 3