0
我的代碼行根本不寫入文件的Out-File
命令:PowerShell的輸出文件是不工作
Move-Item $item.Path $CaminhoCompleto -Force -WhatIf -Verbose |
Out-File -Filepath $SaidaTXT -Append -NoClobber
在它正確地顯示在屏幕上,但該文件是空的。
我的代碼行根本不寫入文件的Out-File
命令:PowerShell的輸出文件是不工作
Move-Item $item.Path $CaminhoCompleto -Force -WhatIf -Verbose |
Out-File -Filepath $SaidaTXT -Append -NoClobber
在它正確地顯示在屏幕上,但該文件是空的。
-WhatIf
消息直接寫入控制檯,不能是piped or redirected而不在不同的PowerShell進程中運行該語句。不過,您可以使用Start-Transcript
捕獲輸出。
Start-Transcript -Path $SaidaTXT -Append
Move-Item ...
Stop-Transcript
是的,我注意到了,於是我用了開始 - 轉錄本。 謝謝。 –