lipkau / PsIni

Work with INI files in PowerShell using hashtables
http://lipkau.github.io/PsIni
MIT License
151 stars 50 forks source link

-IgnoreComments do not work #67

Open MarkStephan89 opened 2 years ago

MarkStephan89 commented 2 years ago

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 :)

nlsdg commented 1 year ago

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.