Automatically download TrackMania United setup
This commit is contained in:
parent
48a9234081
commit
e64de7147a
1 changed files with 9 additions and 12 deletions
|
@ -10,6 +10,7 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Restore-TmUnited([Context] $context) {
|
function Restore-TmUnited([Context] $context) {
|
||||||
|
$setupFile = "TmUnitedForever.exe";
|
||||||
$features = @("DirectPlay", "NetFx3");
|
$features = @("DirectPlay", "NetFx3");
|
||||||
Write-Host "Restoring TrackMania United Forever";
|
Write-Host "Restoring TrackMania United Forever";
|
||||||
|
|
||||||
|
@ -20,23 +21,19 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Information "Determining location of setup file";
|
$tempDir = $context.GetTempDirectory();
|
||||||
$exePath = "";
|
Push-Location $tempDir;
|
||||||
|
Write-Information "Downloading TrackMania United Forever setup";
|
||||||
while (-not (Test-Path $exePath)) {
|
Invoke-WebRequest "http://files.trackmaniaforever.com/tmunitedforever_setup.exe" -OutFile "$setupFile";
|
||||||
$exePath = Read-Host "Please drag'n'drop the setup file here or type the absolute path to the file";
|
|
||||||
|
|
||||||
if (-not (Test-Path $exePath)) {
|
|
||||||
Write-Error "A file at the specified path could not be found.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Information "Installing TrackMania United Forever";
|
Write-Information "Installing TrackMania United Forever";
|
||||||
Start-Process -Wait -FilePath $exePath -ArgumentList @("/Silent");
|
Start-Process -Wait -FilePath $setupFile -ArgumentList @("/Silent");
|
||||||
Write-Information "Removing desktop icon";
|
Write-Information "Removing desktop icon";
|
||||||
Remove-Item "$env:PUBLIC\Desktop\*TmUnitedForever*";
|
Remove-Item "$env:PUBLIC\Desktop\*TmUnitedForever*";
|
||||||
Write-Information "Restoring files";
|
Write-Information "Restoring files";
|
||||||
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
$context.Restore($context.SoftwareArchive($softwareName), $path);
|
||||||
Remove-Item $exePath;
|
Pop-Location;
|
||||||
|
|
||||||
|
Remove-Item -Recurse $tempDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue