Removes an entry/line/setting from an INI file.


Remove-IniEntry [-Path] <String> [-Name] <String> [[-Section] <String>] [-CaseSensitive] [-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:

username = Regina Spektor <>

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.

Be default, operates on the INI file case-insensitively. If your INI is case-sensitive, use the -CaseSensitive switch.

Related Commands


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
CaseSensitive SwitchParameter

Removes INI entries in a case-sensitive manner.

false 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.


Remove-IniEntry -Path C:\Users\me\npmrc -Name 'prefix' -CaseSensitive

Demonstrates how to remove an INI entry in an INI file that is case-sensitive.