Created
March 6, 2018 01:12
-
-
Save anonymous/187178a4c67e415e8b4da7ecbef27859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ini = @" | |
[INI-Version] | |
3 | |
[Server Status] | |
"Online" | |
[Server Enabled] | |
True | |
[Server Host1] | |
"example.com" | |
[Server Host2] | |
"www.example.com"; | |
[Enable Debug Logging] | |
True | |
[GUI Language] | |
"1033" | |
"@ | |
$path = "$env:userprofile\test-(Get-Random).ini" | |
Set-Content -Path $path -Value $ini | |
$content = Get-Content -Path $path -Raw | |
$content2 = $content -replace '(?m)(?<key>^\[Server Host1\]\s+)(?<value>.*)','${key}my new value' | |
$content2 | |
Remove-Item -Path $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment