< Back
Set-IniFileItem
Post
NAME Set-IniFileItem
SYNOPSIS
Set the value of an item in an INI file.
SYNTAX
Set-IniFileItem [-Name] <String> [-Section <String>] [-NewValue] <String> -Path <String>
[-ExpandEnvironmentVariables] [-IncludePadding] [-Encoding <Encoding>] [-EndOfLine <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IniFileItem [-Name] <String> [-Section <String>] -Value <String> [-NewValue] <String> -Path <String>
[-ExpandEnvironmentVariables] [-IncludePadding] [-Encoding <Encoding>] [-EndOfLine <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IniFileItem [-Name] <String> [-Section <String>] -LiteralValue <String> [-NewValue] <String> -Path <String>
[-ExpandEnvironmentVariables] [-IncludePadding] [-Encoding <Encoding>] [-EndOfLine <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
Set the value of an item in an INI file.
Set-IniFileItem allows
PARAMETERS
-Name <String>
The name of an item to add or edit.
If the item does not exist it will be created. Section is mandatory for new items.
Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Section <String>
The name of a section to add the item to. If the section does not exist it will be created.
Section must be defined when adding a new value.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Value <String>
The value may be defined to describe the item. Wildcards are supported.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LiteralValue <String>
The literal value may be defined to absolutely describe the item. Wildcards are not supported.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-NewValue <String>
The value of the item.
Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
The path to an ini file.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-ExpandEnvironmentVariables [<SwitchParameter>]
Request expansion of environment variables within the value.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-IncludePadding [<SwitchParameter>]
Add spaces around the = symbol. For example, sets "Name = Value" instead of "Name=Value".
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Encoding <Encoding>
If the INI file already exists the files current encoding will be used. If not, an encoding may be specified
using this parameter. By default, files are saved using UTF8 encoding with no BOM.
Required? false
Position? named
Default value [System.Text.UTF8Encoding]::new($false)
Accept pipeline input? false
Accept wildcard characters? false
-EndOfLine <String>
The default end of line character used when creating new files.
Required? false
Position? named
Default value [Environment]::NewLine
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-IniFileItem -Name itemName -NewValue someValue -Path config.ini
Set a value for itemName in config.ini.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-IniFileItem -Name itemName -Value currentValue -NewValue newValue -Path config.ini
Set a new value for itemName with value currentValue.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-IniFileItem -Name extension -Value ldap -NewValue ldap -Path php.ini
Set a value for extension to LDAP. Other extension items in the file are ignored because of the Value filter.
RELATED LINKS
SYNOPSIS
Set the value of an item in an INI file.
SYNTAX
Set-IniFileItem [-Name] <String> [-Section <String>] [-NewValue] <String> -Path <String>
[-ExpandEnvironmentVariables] [-IncludePadding] [-Encoding <Encoding>] [-EndOfLine <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IniFileItem [-Name] <String> [-Section <String>] -Value <String> [-NewValue] <String> -Path <String>
[-ExpandEnvironmentVariables] [-IncludePadding] [-Encoding <Encoding>] [-EndOfLine <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-IniFileItem [-Name] <String> [-Section <String>] -LiteralValue <String> [-NewValue] <String> -Path <String>
[-ExpandEnvironmentVariables] [-IncludePadding] [-Encoding <Encoding>] [-EndOfLine <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
Set the value of an item in an INI file.
Set-IniFileItem allows
PARAMETERS
-Name <String>
The name of an item to add or edit.
If the item does not exist it will be created. Section is mandatory for new items.
Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Section <String>
The name of a section to add the item to. If the section does not exist it will be created.
Section must be defined when adding a new value.
Required? false
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Value <String>
The value may be defined to describe the item. Wildcards are supported.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LiteralValue <String>
The literal value may be defined to absolutely describe the item. Wildcards are not supported.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-NewValue <String>
The value of the item.
Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
The path to an ini file.
Required? true
Position? named
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-ExpandEnvironmentVariables [<SwitchParameter>]
Request expansion of environment variables within the value.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-IncludePadding [<SwitchParameter>]
Add spaces around the = symbol. For example, sets "Name = Value" instead of "Name=Value".
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Encoding <Encoding>
If the INI file already exists the files current encoding will be used. If not, an encoding may be specified
using this parameter. By default, files are saved using UTF8 encoding with no BOM.
Required? false
Position? named
Default value [System.Text.UTF8Encoding]::new($false)
Accept pipeline input? false
Accept wildcard characters? false
-EndOfLine <String>
The default end of line character used when creating new files.
Required? false
Position? named
Default value [Environment]::NewLine
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-IniFileItem -Name itemName -NewValue someValue -Path config.ini
Set a value for itemName in config.ini.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-IniFileItem -Name itemName -Value currentValue -NewValue newValue -Path config.ini
Set a new value for itemName with value currentValue.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Set-IniFileItem -Name extension -Value ldap -NewValue ldap -Path php.ini
Set a value for extension to LDAP. Other extension items in the file are ignored because of the Value filter.
RELATED LINKS