Last active
June 30, 2024 16:37
-
-
Save VIRUXE/4a5026bd77f11db3b72266d560f00269 to your computer and use it in GitHub Desktop.
FXServer Start Utility script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([string]$ServerName) | |
function Test-Server($folder) { Test-Path "$folder/server.cfg" } | |
do { | |
if (-not $ServerName -or -not (Test-Server $ServerName)) { | |
Write-Host | |
$servers = Get-ChildItem -Directory | Where-Object { Test-Server $_.FullName } | |
if ($servers.Count -eq 0) { | |
Write-Host "No servers found." | |
continue | |
} | |
$servers | ForEach-Object { Write-Host "$($servers.IndexOf($_) + 1): $($_.Name)" } | |
$selection = Read-Host "Select a server by number" | |
$ServerName = $servers[$selection - 1].Name | |
} | |
Write-Host | |
Write-Host "Starting server: $ServerName" | |
Write-Host | |
Set-Location $ServerName | |
Start-Process -FilePath "$PSScriptRoot\artifacts\FXServer.exe" -ArgumentList "+exec server.cfg" -NoNewWindow -Wait | |
Set-Location $PSScriptRoot | |
Write-Host | |
Write-Host "Server stopped. If you wish to start another server, please follow the prompts." | |
Write-Host | |
$ServerName = $null | |
$continue = Read-Host "Do you want to start another server? (Y/N)" | |
} while ($continue -eq 'Y') | |
Write-Host | |
Write-Host "Press any key to continue..." | |
[Console]::ReadKey() | Out-Null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment