PowerShell Script to Swap Halo’s Map Folder

Standard

Recently, Bungie patched Halo: Combat Evolved because it used GameSpy to generate the multiplayer server list, and GameSpy is shutting down.

I was inspired to re-install Halo and set up the old mods I used to play. My favorite was called “Snipers Dream Team Mod,” a mod in which snipers shoot tank shells… along with some other goodies.

Back when I played, enabling/disabling mods was fairly crude: you had to have a copy of every map that you would manually swap between.

I wanted to automate the process of swapping the map folders, so wrote the following PowerShell script. Coincidentally, it’s also my first ever script. I’m sure there are better ways to do it.

The script assumes that you have your default maps folder named “Maps” and your folder with SDTM mods named “Maps-SDTM.”

$root = "C:\Program Files (x86)\Microsoft Games\Halo"

# if sdtm is prefixed, install them
if(Test-Path("$root\Maps-SDTM"))
{
    Move-Item "$root\Maps" "$root\Maps-Default"
    Move-Item "$root\Maps-SDTM" "$root\Maps"
    [System.Windows.Forms.MessageBox]::Show("SDTM Maps Activated")
}
# otherwise install the default
else
{
    Move-Item "$root\Maps" "$root\Maps-SDTM"
    Move-Item "$root\Maps-Default" "$root\Maps"
    [System.Windows.Forms.MessageBox]::Show("Default Maps Activated")
}