< Back

Remove-CIniEntry

Sun Jan 12, 2020 10:54 pm

NAME Remove-CIniEntry



SYNOPSIS

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





SYNTAX

Remove-CIniEntry [-Path] <String> [-Name] <String> [[-Section] <String>] [-CaseSensitive] [-WhatIf] [-Confirm]

[<CommonParameters>]





DESCRIPTION

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-CIni`. [See its documentation for more examples.](Split-CIni.html)



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.





PARAMETERS

-Path <String>

The path to the INI file.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <String>

The name of the INI entry to remove.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Section <String>

The section of the INI where the entry should be set.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CaseSensitive [<SwitchParameter>]

Removes INI entries in a case-sensitive manner.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Remove-CIniEntry -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.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Remove-CIniEntry -Path C:\\Users\\me\\npmrc -Name 'prefix' -CaseSensitive



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











RELATED LINKS

Set-CIniEntry

Split-CIni