param([ValidateSet('create','start','stop','remove','status')][string]$Action = 'status') $ErrorActionPreference = 'Stop' $taskRoot = Split-Path -Parent $PSScriptRoot $taskPython = 'C:/Users/Administrator/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe' if (-not (Test-Path -LiteralPath $taskPython)) { $taskPython = (Get-Command python -ErrorAction Stop).Source } $env:PYTHONUTF8 = '1' & $taskPython (Join-Path $PSScriptRoot 'robot_simulator.py') $Action if ($LASTEXITCODE -ne 0) { throw "模拟器操作失败:$Action" }