致谢 感谢 嘉钰 、寒山雨(腾讯云选购服务器:微信:mumuxi1019)大佬的安装脚本及教程。 问题解答 在文章最下方,常见问题可参考解决。如有疑问,可发送在评论区。 windows端 脚本分析 一键安装 源代码 param (
[switch]$EnableAutoRestart,
[int]$ServerPort
)
$ErrorActionPreference = "Stop"
# 定义要检查的进程名称
$ProcessNames = @("PalServer", "PalServer-Win64-Test-Cmd")
foreach ($ProcessName in $ProcessNames) {
if (Get-Process $ProcessName -ErrorAction SilentlyContinue) {
Write-Host "$ProcessName is already running."
exit
}
}
# 初始化安装目录
$DirectoryPath = "C:\Program Files\PalServer\"
if (-not (Test-Path -Path $directoryPath)) {
New-Item -ItemType Directory -Path $directoryPath | Out-Null
}
# 下载安装 C++ 运行库
Write-Host "Start download vc_redist.x64.exe..."
$VcUrl = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
$VcOutput = "C:\Program Files\PalServer\vc_redi...