Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
Function Show-SimCityLoadingScreen {
Create a new PowerShell window that scrolls through classic Sim City loading messages
# Create loading screen
$loadingScreen = Show-SimCityLoadingScreen
'Doing something...'
Start-Sleep -Seconds 10
# Close loading screen
Show-SimCityLoadingScreen -WindowTitle 'Custom title' -WelcomeMessage 'Custom welcome message' -WindowHeight 20 -WindowWidth 80
This function is a wrapper for loading_screen_script.ps1
param (
# Decide whether to spawn pwsh or powershell
$powerShellPath = if ($PSEdition -eq 'Core') {'pwsh'} else {'powershell'}
# Construct PowerShell arguments
$loadingScreenPath = Join-Path $PSScriptRoot 'loading_screen_script.ps1'
$psArguments = @()
$psArguments += '-ExecutionPolicy Bypass'
$psArguments += "-File `"$loadingScreenPath`""
if ($WindowTitle) {$psArguments += "-WindowTitle `"$WindowTitle`""}
if ($WindowHeight) {$psArguments += "-WindowHeight $WindowHeight"}
if ($WindowWidth) {$psArguments += "-WindowWidth $WindowWidth"}
if ($WelcomeMessage) {$psArguments += "-WelcomeMessage `"$WelcomeMessage`""}
# Launch loading screen script and return process object
# The process object can later be killed to close the window
return Start-Process -FilePath $powerShellPath -PassThru -ArgumentList $psArguments