Skip to content

Instantly share code, notes, and snippets.

@daserge
Created April 22, 2016 15:09
Show Gist options
  • Select an option

  • Save daserge/ac08b510a8cc401f0654cd67e06057e4 to your computer and use it in GitHub Desktop.

Select an option

Save daserge/ac08b510a8cc401f0654cd67e06057e4 to your computer and use it in GitHub Desktop.
(get-content config.xml) | foreach-object {
$wordToFind='windows-target-version'
$containsWord=$_ -match $wordToFind
If($containsWord -contains $true) {
$_ -replace '(<preference name=\"windows-target-version\" value=\")([^\"]+)(\" \/><\/widget>)', '${1}10.0${3}'
} Else {
$_ -replace '<\/widget>', '<preference name="windows-target-version" value="10.0" /></widget>'
}
} | set-content config.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment