我正在尝试使用命令让https://docs.microsoft.com/en-us/powershell/scripting/samples/redirecting-data-with-out---cmdlets?view=powershell-7 如下
PS C:\WINDOWS\system32> Get-Process | Format-List | Out-Host -Paging | OutFile -FilePath C:\Users\didja\koera dutata\forum questions\out.txt
OutFile : The term 'OutFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:48
+ Get-Process | Format-List | Out-Host -Paging | OutFile -FilePath C:\U ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (OutFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-Process | Format-List | Out-Host -Paging | OutFile -FilePath C:\Users\didja\koera dutata\forum questions\out.txt
OutFile : The term 'OutFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:48
+ Get-Process | Format-List | Out-Host -Paging | OutFile -FilePath C:\U ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (OutFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-Process | Format-List | Out-Host -Paging | OutFile -FilePath "C:\Users\didja\koera dutata\forum questions\out.txt"
OutFile : The term 'OutFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:48
+ Get-Process | Format-List | Out-Host -Paging | OutFile -FilePath "C:\ ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (OutFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-Process | Out-Host -Paging | OutFile -FilePath "C:\Users\didja\koera dutata\forum questions\out.txt"
OutFile : The term 'OutFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:35
+ Get-Process | Out-Host -Paging | OutFile -FilePath "C:\Users\Danda K ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (OutFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-Process | OutFile -FilePath "C:\Users\didja\koera dutata\forum questions\out.txt"
OutFile : The term 'OutFile' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:16
+ Get-Process | OutFile -FilePath "C:\Users\didja\koera duta ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (OutFile:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
上述用法有什么错误?
我认为您正在尝试做 T 恤。这是您需要的:
out-host
并且out-file
是互斥的。您需要使用其中一种。