Write-Host Flashcards

(14 cards)

1
Q

What does this PowerShell cmdlet do?

Write-Host

A

Displays output directly to the console.
## Footnote
Use only for visual feedback — it does NOT send data to the pipeline.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which cmdlet would you use to do the following?

Print output directly to the screen (not to the pipeline).

A

Write-Host

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does this Write-Host parameter do?

-Object

A

Specifies the text or object to display.
## Footnote
This is what gets written to the screen.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which parameter would you use with Write-Host to do the following?

Define what text or object to display on the screen.

A

-Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does this Write-Host parameter do?

-ForegroundColor

A

Sets the text colour.
## Footnote
E.g. Red, Yellow, Green, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which parameter would you use with Write-Host to do the following?

Set the text colour of console output.

A

-ForegroundColor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does this Write-Host parameter do?

-BackgroundColor

A

Sets the background colour of the text.
## Footnote
E.g. DarkBlue, Black, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which parameter would you use with Write-Host to do the following?

Set the background colour of console output.

A

-BackgroundColor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does this Write-Host parameter do?

-NoNewline

A

Prevents a line break after the output.
## Footnote
Keeps the cursor on the same line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which parameter would you use with Write-Host to do the following?

Prevent a newline after printing text.

A

-NoNewline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What datatype is required for the following parameter:

Write-Host -Object

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What datatype is required for the following parameter:

Write-Host -ForegroundColor

A

ConsoleColor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What datatype is required for the following parameter:

Write-Host -BackgroundColor

A

ConsoleColor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What datatype is required for the following parameter:

Write-Host -NoNewline

A

None: parameter is a switch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly