Removes an entry/line/setting from an INI file.
Remove-IniEntry [-Path] <String> [-Name] <String> [[-Section] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
A configuration file consists of sections, led by a [section]
header and followed by name = value
entries. This function removes an entry in an INI file. Something like this:
[ui]
username = Regina Spektor <regina@reginaspektor.com>
[extensions]
share =
extdiff =
Names are not allowed to contains the equal sign, =
. Values can contain any character. The INI file is parsed using Split-Ini
. See its documentation for more examples.
If the entry doesn't exist, does nothing.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Path | String | The path to the INI file. | true | false | |
Name | String | The name of the INI entry to remove. | true | false | |
Section | String | The section of the INI where the entry should be set. | false | false | |
WhatIf | SwitchParameter | false | false | ||
Confirm | SwitchParameter | false | false | ||
CommonParameters | This cmdlet supports common parameters. For more information type Get-Help about_CommonParameters . |
Remove-IniEntry -Path C:\Projects\Carbon\StupidStupid.ini -Section rat -Name tails
Removes the tails
item in the [rat]
section of the C:\Projects\Carbon\StupidStupid.ini
file.