< Back
Set-CIniEntry
Post
NAME Set-CIniEntry
SYNOPSIS
Sets an entry in an INI file.
SYNTAX
Set-CIniEntry [-Path] <String> [-Name] <String> [[-Value] <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 creates or updates 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)
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 to set.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Name <String>
The name of the INI entry being set.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Value <String>
The value of the INI entry being set.
Required? false
Position? 3
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? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CaseSensitive [<SwitchParameter>]
Treat the INI file 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:\\>Set-CIniEntry -Path C:\\Users\\rspektor\\mercurial.ini -Section extensions -Name share -Value ''
If the `C:\\Users\\rspektor\\mercurial.ini` file is empty, adds the following to it:
[extensions]
share =
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-CIniEntry -Path C:\\Users\\rspektor\\music.ini -Name genres -Value 'alternative,rock'
If the `music.ini` file is empty, adds the following to it:
genres = alternative,rock
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-CIniEntry -Path C:\\Users\\rspektor\\music.ini -Name genres -Value 'alternative,rock,world'
If the `music.ini` file contains the following:
genres = r&b
After running this command, `music.ini` will look like this:
genres = alternative,rock,world
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Set-CIniEntry -Path C:\\users\\me\\npmrc -Name prefix -Value 'C:\\Users\\me\\npm_modules' -CaseSensitive
Demonstrates how to set an INI entry in a case-sensitive file.
RELATED LINKS
Split-CIni
LINK
Remove-CIniEntry
SYNOPSIS
Sets an entry in an INI file.
SYNTAX
Set-CIniEntry [-Path] <String> [-Name] <String> [[-Value] <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 creates or updates 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)
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 to set.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Name <String>
The name of the INI entry being set.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Value <String>
The value of the INI entry being set.
Required? false
Position? 3
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? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CaseSensitive [<SwitchParameter>]
Treat the INI file 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:\\>Set-CIniEntry -Path C:\\Users\\rspektor\\mercurial.ini -Section extensions -Name share -Value ''
If the `C:\\Users\\rspektor\\mercurial.ini` file is empty, adds the following to it:
[extensions]
share =
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-CIniEntry -Path C:\\Users\\rspektor\\music.ini -Name genres -Value 'alternative,rock'
If the `music.ini` file is empty, adds the following to it:
genres = alternative,rock
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-CIniEntry -Path C:\\Users\\rspektor\\music.ini -Name genres -Value 'alternative,rock,world'
If the `music.ini` file contains the following:
genres = r&b
After running this command, `music.ini` will look like this:
genres = alternative,rock,world
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Set-CIniEntry -Path C:\\users\\me\\npmrc -Name prefix -Value 'C:\\Users\\me\\npm_modules' -CaseSensitive
Demonstrates how to set an INI entry in a case-sensitive file.
RELATED LINKS
Split-CIni
LINK
Remove-CIniEntry