如果我在使用 powershell 命令时遇到错误,输出会被修剪三个点。
PowerShell 错误中的三个点“...”,表示有有关该错误的更多信息,但为了简洁起见,它已从显示的消息中省略。您通常可以通过将错误传递到 cmdlet(如
Format-List
或 Out-String
)来获取完整的错误详细信息。
但是,我发现这并不能得到完整的输出。我还能做些什么来获得完整的输出吗?;)
$结果 = 调用-AzOperationalInsightsQuery -WorkspaceId $appId -Query $query Invoke-AzOperationalInsightsQuery:操作返回无效的状态代码“NotFound” 在行:1 字符:11
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
请参阅
$error[0] | select *
了解更多信息:
dir foo3
dir : Cannot find path 'C:\users\admin\foo3' because it does not exist.
At line:1 char:1
+ dir foo3
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\users\admin\foo3:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
$error[0] | select *
writeErrorStream : True
PSMessageDetails :
Exception : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\users\admin\foo3'
because it does not exist.
at System.Management.Automation.SessionStateInternal.GetChildItems(String path, Boolean
recurse, UInt32 depth, CmdletProviderContext context)
at Microsoft.PowerShell.Commands.GetChildItemCommand.ProcessRecord()
TargetObject : C:\users\admin\foo3
CategoryInfo : ObjectNotFound: (C:\users\admin\foo3:String) [Get-ChildItem], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}