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.
-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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.