Write-Debug - PowerShell


 

Writes a debug message to the console. (Write-Debug)

   

# NAME
Write-Debug

# SYNOPSIS
Writes a debug message to the console.

# SYNTAX
Write-Debug [-Message] <string> [<CommonParameters>]

# DESCRIPTION
The Write-Debug cmdlet writes debug messages to the console from a script or command.

By default, debug messages are not displayed in the console, but you can display them by using the Debug parameter or the $DebugPreference variable.

# PARAMETERS
-Message <string>
Specifies the debug message to send to the console.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.String
You can pipe a string that contains a debug message to Write-Debug.

# OUTPUTS
None
Write-Debug writes only to the debug stream. It does not return any output.

# NOTES

# EXAMPLE 1

C:\PS>Write-Debug "Cannot open file."

# Description
-----------
This command writes a debug message. Because the value of $DebugPreference is "SilentlyContinue", the message is not displayed in the console.

# EXAMPLE 2

C:\PS>$DebugPreference

SilentlyContinue

C:\PS> Write-Debug "Cannot open file."
C:\PS>

C:\PS> Write-Debug "Cannot open file." -debug
DEBUG: Cannot open file.

# Description
-----------
This example shows how to use the Debug common parameter to override the value of the $DebugPreference variable for a particular command.

The first command displays the value of the $DebugPreference variable, which is "SilentlyContinue", the default.

The second command writes a debug message but, because of the value of $DebugPreference, the message does not appear.

The third command writes a debug message. It uses the Debug common parameter to override the value of $DebugPreference and to display the debug messages resulting from this command.

As a result, even though the value of $DebugPreference is "SilentlyContinue", the debug message appears.

For more information about the Debug common parameter, see about_CommonParameters.

# EXAMPLE 3

C:\PS>$DebugPreference

SilentlyContinue

C:\PS> Write-Debug "Cannot open file."
C:\PS>

C:\PS> $DebugPreference = "Continue"

C:\PS> Write-Debug "Cannot open file."
DEBUG: Cannot open file.

# Description
-----------
This command shows the effect of changing the value of the $DebugPreference variable on the display of debug messages.

The first command displays the value of the $DebugPreference variable, which is "SilentlyContinue", the default.

The second command writes a debug message but, because of the value of $DebugPreference, the message does not appear.

The third command assigns a value of "Continue" to the $DebugPreference variable.

The fourth command writes a debug message, which appears on the console.

For more information about $DebugPreference, see about_Preference_Variables.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113424
Write-Verbose
Write-Error
Write-Host
Write-Progress
Write-Output
Write-Warning

C:\Windows>powershell get-help Write-Verbose -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Writes a debug message to the console.

HTTP: ... PS_Windows/en/Write-Debug.htm
0.171
10064

The auto power options adjustment to increase energy efficiency is ok!

 /

Windows Desktop shortcut for Excel, Outlook, Word 2013 / 365, how to!

 /

How to open the Computer-Management in Windows 8.1, 8 or win 10?

 /

Wie kann ich das 7-Zip Kontextmenü auf deutsch umstellen, Windows 7/8.1/10?

 /

Zeitstempel von einer bestimmten Windows Datei, Ordner, oder Verlauf verwenden!

 /

Auto login windows 10 excluding password?

 /

Fußbälle am Desktop auch ohne Sky Receiver!

 /

Kann man das klassische Design in Windows 10 aktivieren!

 /

Change product key in windows 10 for a new activation of Win-10, how-to?

 /

What is the difference between power off/on and restart of the mobile smart phone?

 /

Find, start and run the Troubleshooting in Windows-10?

 /

Create a password reset disk for Windows 8.1 and Win 10 PW recovery?

 /