Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Write-Host to output $true

Tags:

powershell

I'm writing a powershell script which uses write-host to output another powershell script. How can I write out a boolean parameter with the value $true (or $false) including the dollar sign:

param
(
    [switch] $myParam = $true
)

Write-Host My Param is $myParam

I need this to output exactly

My Param is $True

But it outputs

My Param is True
like image 552
Daniel Flippance Avatar asked Jun 26 '13 18:06

Daniel Flippance


1 Answers

You can escape a $ with a `:

Write-Host My Param is `$$myParam
like image 200
Lee Avatar answered Oct 13 '22 00:10

Lee