深入理解 PowerShell 基础概念
1. PowerShell 输出配置
PowerShell 中有一些变量可用于配置其返回的各种输出类型,例如:
- VerbosePreference :默认为 SilentlyContinue
- WarningPreference :默认为 Continue
- WhatIfPreference :默认为 False
当你在 PowerShell 中犯错误时,会看到红色的错误文本,这就是错误输出流。可以通过以下命令生成错误消息:
PS> Get-Variable -Name 'doesnotexist'
输出结果如下:
Get-Variable : Cannot find a variable with the name 'doesnotexist'.
At line:1 char:1
+ Get-Variable -Name 'doesnotexist'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (doesnotexist:String) [Get-Variable],
ItemNotFoundExc
超级会员免费看
订阅专栏 解锁全文
2432

被折叠的 条评论
为什么被折叠?



