[英]Getting PowerShell to post all information to out file
PowerShell is writing information to file when I delete a registry entry successfully however I also need it to post errors to the file instead of the PS session. 当我成功删除注册表项时,PowerShell正在将信息写入文件,但是我还需要它向文件而不是PS会话中发布错误。
Remove-Item -Path $path -Force -Verbose 4>&1 | Out-File "c:\registryresults.txt"
How would I be best able to achieve this? 我怎样才能最好地做到这一点?
4>&1
is the 'Verbose' stream being redirected to the 'output' stream. 4>&1
是“详细”流被重定向到“输出”流。
you probably want to use *>&1
or just *> "c:\\registryresults.txt"
on its own without the Out-File
您可能想单独使用
*>&1
或仅使用*> "c:\\registryresults.txt"
而没有Out-File
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.