powershell write-debug blank line

Question:

Is there a way to get Write-Debug to print a blank line without printing DEBUG:
Ex:

Write-Debug n

Write-Debug n # additional parameters or command here

Write-Debug `n

Output :>

DEBUG:

DEBUG:

Answer:

You could do this by creating function Write-Debug like this:

If you create new function with the same name as a cmdlet, you hide the original cmdlet, because PowerShell will first try to find function with name Write-Debug. If there is none, PowerShell tries to find cmdlet with that name. (generally the first type of command that PowerShell tries to find is alias, not a function).

Source:

powershell write-debug blank line by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply