Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
让PowerShell将所有信息发布到out文件_Powershell - Fatal编程技术网

让PowerShell将所有信息发布到out文件

让PowerShell将所有信息发布到out文件,powershell,Powershell,当我成功删除注册表项时,PowerShell正在将信息写入文件,但我还需要它将错误发布到文件,而不是PS会话 Remove-Item -Path $path -Force -Verbose 4>&1 | Out-File "c:\registryresults.txt" 如何才能最好地实现这一点?4>&1是重定向到“输出”流的“详细”流 您可能希望单独使用*>&1或*>c:\registryresults.txt,而不使用输出文件Add 2>&1或将4>&1更改为*>&1。

当我成功删除注册表项时,PowerShell正在将信息写入文件,但我还需要它将错误发布到文件,而不是PS会话

Remove-Item -Path $path -Force -Verbose 4>&1 | Out-File "c:\registryresults.txt"
如何才能最好地实现这一点?

4>&1是重定向到“输出”流的“详细”流

您可能希望单独使用*>&1或*>c:\registryresults.txt,而不使用输出文件

Add 2>&1或将4>&1更改为*>&1。