Write-Verbose
將文字寫入詳細資訊訊息數據流。
語法
Default (預設值)
Write-Verbose
[-Message] <String>
[<CommonParameters>]
Description
Write-Verbose Cmdlet 會將文字寫入 PowerShell 中的詳細資訊訊息數據流。 一般而言,詳細資訊訊息數據流可用來提供有關命令處理的更深入資訊。
根據預設,不會顯示詳細資訊訊息數據流,但您可以在任何命令中變更 $VerbosePreference 變數的值或使用 Verbose common 參數來顯示它。
範例
範例 1:寫入狀態消息
Write-Verbose -Message "Searching the Application Event Log."
Write-Verbose -Message "Searching the Application Event Log." -Verbose
這些命令會使用 Write-Verbose Cmdlet 來顯示狀態消息。 根據預設,不會顯示訊息。
第二個命令會使用 Verbose common 參數,不論 $VerbosePreference 變數的值為何,都會顯示任何詳細資訊訊息。
範例 2:設定$VerbosePreference並寫入狀態消息
$VerbosePreference = "Continue"
Write-Verbose "Copying file $filename"
這些命令會使用 Write-Verbose Cmdlet 來顯示狀態消息。 根據預設,不會顯示訊息。
第一個命令會將 [繼續] 值指派給 $VerbosePreference 喜好設定變數。 預設值 SilentlyContinue會隱藏詳細資訊訊息。 第二個命令會寫入詳細資訊訊息。
參數
-Message
指定要顯示的訊息。 這是必要參數。 您也可以使用管線將訊息字串傳送至 Write-Verbose。
參數屬性
| 類型: | String |
| 預設值: | None |
| 支援萬用字元: | False |
| 不要顯示: | False |
| 別名: | 味精 |
參數集
(All)
| Position: | 0 |
| 必要: | True |
| 來自管線的值: | True |
| 來自管線按屬性名稱的值: | False |
| 來自剩餘引數的值: | False |
CommonParameters
此 Cmdlet 支援一般參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。
輸入
String
您可以使用管線將包含訊息的字串傳送至此 Cmdlet。
輸出
None
此 Cmdlet 不會傳回任何輸出。 它只會寫入詳細資訊訊息數據流。
備註
- 只有當命令使用 Verbose 一般參數時,才會傳回詳細資訊訊息。 如需詳細資訊,請參閱 about_CommonParameters。
- 在 Windows PowerShell 背景工作和遠端命令中,作業工作和遠端作業階段中的
$VerbosePreference變數會決定預設是否顯示詳細資訊訊息。 如需$VerbosePreference變數的詳細資訊,請參閱 about_Preference_Variables。