代码拉取完成,页面将自动刷新
# 定义启动服务的函数
function Start-Service {
param (
[Parameter(Mandatory = $true)]
[string]$ServiceName,
[Parameter(Mandatory = $true)]
[string]$Command
)
# 启动新的 PowerShell 窗口来运行服务
$psi = New-Object System.Diagnostics.ProcessStartInfo
$psi.FileName = "powershell"
$psi.Arguments = "-Command $Command"
$psi.UseShellExecute = $false
$psi.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Normal
[System.Diagnostics.Process]::Start($psi)
Write-Host "$ServiceName 服务启动命令已发送到新窗口."
}
# 获取当前脚本的绝对路径
$scriptPath = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
# 构建命令
$usercenterRPCCommand = "cd `"$scriptPath\usercenter\cmd\rpc`"; go run usercenter.go -f etc\usercenter.yaml"
$usercenterAPICommand = "cd `"$scriptPath\usercenter\cmd\api`"; go run usercenter.go -f etc\usercenter-api.yaml"
$gameRPCCommand = "cd `"$scriptPath\game\cmd\rpc`"; go run game.go -f etc\game.yaml"
$gameAPICommand = "cd `"$scriptPath\game\cmd\api`"; go run game.go -f etc\game-api.yaml"
# 启动所有服务
Start-Service "usercenter RPC" $usercenterRPCCommand
Start-Service "usercenter API" $usercenterAPICommand
Start-Service "game RPC" $gameRPCCommand
Start-Service "game API" $gameAPICommand
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。