Command & Conquer

From LANCommander
Revision as of 07:01, 31 July 2023 by DoctorDalek (talk | contribs) (Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Release Date = {{Game.InfoBox.ReleaseDate|Windows|August 31, 1995}} | PCGamingWiki = Command_%26_Conquer }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play|Path = CnC95MPLauncher.exe|Arguments = |WorkingDirectory = |Primary = True}} }} {{Game.Scripts.NameChange |Name = Name Change Script |Description = |RequiresAdmin = False |Contents = <syntaxhighlight lang="powershell" line> $NewName = $args[0] $Ins...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Release Date
Windows: August 31, 1995
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play CnC95MPLauncher.exe True

Name Change Script

$NewName = $args[0]
$InstallDir = $PSScriptRoot

function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}

Write-ReplaceContentInFile -Regex '^Nickname=(.+)' -Replacement "Nickname=$NewName" -FilePath "$InstallDir\cncnet5.ini"