param([string]$u) $workDir = "$env:USERPROFILE\Desktop\PortableMC" $exePath = "$workDir\portablemc.exe" $datPath = "$workDir\servers.dat" if (!(Test-Path $workDir)) { New-Item -ItemType Directory -Path $workDir | Out-Null } if (!(Test-Path $exePath)) { Invoke-WebRequest -Uri "https://b4.nu/portablemc.exe" -OutFile $exePath -UseBasicParsing } if (!(Test-Path $datPath)) { Invoke-WebRequest -Uri "https://b4.nu/servers.dat" -OutFile $datPath -UseBasicParsing } # Username Logic (Press Enter for Random) if (-not $u) { $u = Read-Host "Enter Username (Press Enter for Random)" } $userFlag = if ($u) { "-u `"$u`"" } else { "" } Set-Location -Path $workDir Write-Host "`nLaunching Minecraft..." -ForegroundColor Green Invoke-Expression ".\portablemc.exe --main-dir . start $userFlag"