$NewName = $args[0]
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
$content = (Get-Content $FilePath) -replace $Regex, $Replacement
[IO.File]::WriteAllLines($FilePath, $content)
}
# Trim a string down to a specified amount of characters
if ($NewName.Length -gt 24) {
$NewName = $NewName.Substring(0, 24);
}
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Regex '^Name=(.+)' -Replacement "Name=$NewName" -FilePath "$InstallDir\soldat.ini"
# TEST
# One