如下说明是翻译
: help write-debug
产生的帮助信息
.
译者
: Edengundam(
马涛
)
Write-Debug
大纲
输出调式信息到
host.
语法
Write-Debug [-message] <string> [<CommonParameters>]
详细描述
从脚本或命令中输出调试信息到控制台
.
信息是否被输出到控制台
,
取决于
$DebugPreference
变量
.
输入
$DebugPreference
产看该变量的当前取值
.
为当前会话设置该变量的值
,
输入
$DebugPreference = "<value>".
合法取值为
: SilentlyContinue, Stop, Continue
和
Inquire.
如果设置为
SilentlyContinue, Write-Debug
将不会向控制台输出任何信息
.
参数
-message <string>
指定发送到控制台的调试信息
.
强制参数
?
|
true
|
参数位置
?
|
1
|
默认值
|
|
允许从管道绑定输入
?
|
true (
传值
)
|
允许通配符扩展
?
|
false
|
<
公共参数
>
此命令支持公共参数
: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable.
更多信息
,
输入
, "get-help about_commonparameters".
输入类型
字符串
返回类型
无
注意
更多信息
,
输入
"Get-Help Write-Debug -detailed".
需要技术信息
,
输入
"Get-Help Write-Debug -full".
如果需要为该命令提供多个参数
,
请使用逗号进行分隔
.
例如
, "<parameter-name> <value1>, <value2>".
例
1
C:/PS>$DebugPreference = "Continue"
Write-Debug "This script has attempted to open file xyx and cannot."
$DebugPreference = "SilentlyContinue"
Write-Debug "This is another debug statement."
此命令输出的调式信息
,
将根据
$DebugPreference
变量的取值来决定是否显示
.
当该变量取值为
"SilentlyContinue"
意味着不输出该语句
.
当该变量取值为
"Continue"
意味着输出该值
.
DEBUG: This script has attempted to open file xyx and cannot.
相关链接
Write-Verbose
Write-Error
Write-Host
Write-Progress
Write-Output
Write-Warning