Skip to content

Commit 4ef6c31

Browse files
authored
Update Output-and-Formatting.md
1 parent 845f55e commit 4ef6c31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Best-Practices/Output-and-Formatting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TODO: This whole document is STILL ROUGH DRAFT
66

77
Previous to PowerShell 5, Write-Host has no functionality at all in non-interactive scripts. It cannot be captured or redirected, and therefore should only be used in functions which are "Show"ing or "Format"ing output, or to display something as part of an interactive prompt to the user.
88

9-
That is: you should not use Write-Host to create script output unless your script (or function, or whatever) uses the Show verb (as in, Show-Performance) or the Format verb (as in, Format-Hex), or has a `-Formatted` switch parameter. You may also use it to build interactions with the user in other cases (e.g. to write extra information to the screen before prompting the user for a choice or input).
9+
That is: you should not use Write-Host to create script output unless your script (or function, or whatever) uses the Show verb (as in, Show-Performance) or the Format verb (as in, Format-Hex), or has a `-Formatted` switch parameter. You may also use it to build interactions with the user in other cases (e.g., to write extra information to the screen before prompting the user for a choice or input).
1010

1111
Generally, you should consider the other Write-* commands first when trying to give information to the user.
1212

@@ -22,7 +22,7 @@ You should use verbose output for information that contains details about the va
2222

2323
## Use Write-Debug to give information to someone maintaining your script
2424

25-
You should use the debug output stream for output that is useful for script debugging (e.g.: "Now entering main loop" or "Result was null, skipping to end of loop"), or to display the value of a variable before a conditional statement, so the maintainer can break into the debugger if necessary.
25+
You should use the debug output stream for output that is useful for script debugging (e.g., "Now entering main loop" or "Result was null, skipping to end of loop"), or to display the value of a variable before a conditional statement, so the maintainer can break into the debugger if necessary.
2626

2727
> TIP: When debugging you should be aware that you can set `$DebugPreference = "Continue"` to see this information on screen without entering a breakpoint prompt.
2828

0 commit comments

Comments
 (0)