PsIni
PsIni copied to clipboard
-IgnoreComments do not work
Hi, I test the IgnoreComments, but it do not work
I test these: Get-IniContent (-FilePath "C:\temp\abc.ini" -IgnoreComments) Get-IniContent (-FilePath "C:\temp\abc.ini" -IgnoreComments $true)
Thanks :)
You need to remove the parentheses ().
Get-IniContent -FilePath "C:\temp\abc.ini" -IgnoreComments
If a switch is present on the command it's $true, If it's not, it's $false. It is possible to set the value explicitly:
Get-IniContent -FilePath "C:\temp\abc.ini" -IgnoreComments:$true
or you can do it with a variable:
[bool]$commentYN=$false
Get-IniContent -FilePath "C:\temp\abc.ini" -IgnoreComments:$commentYN
For future questions: it would be helpful if you also include the error you get or the output from the command.