Soldat

From LANCommander
Revision as of 01:28, 1 August 2023 by DoctorDalek (talk | contribs) (Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Transhuman Design}} |Publishers = {{Game.InfoBox.Publisher|Transhuman Design}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|May 9, 2002}} |Genres = {{Game.InfoBox.Genre|Shooter}} {{Game.InfoBox.Genre|Indie}} | PCGamingWiki = Soldat }} {{Game.Scripts.NameChange |Name = Name Change Script |Description = |RequiresAdmin = False |Contents = <syntaxhighlight lang="powershell" li...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Transhuman Design
Publishers
Transhuman Design
Release Date
Windows: May 9, 2002
Genres
Shooter

Indie

View at PCGamingWiki

Name Change Script

$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