NavisworksTransport/deploy-plugin.bat
tian 488e69d27a fix: 脚本统一用 pwsh 替代 powershell,MSTest adapter 动态查找
- start-navisworks.bat / run-ground-virtual-collision-test.bat:
  powershell → pwsh(避免依赖 shim/PS5.1,UTF-8 中文输出更可靠)
- deploy-plugin.bat 提权兜底:PowerShell → pwsh(内外一致)
- run-unit-tests.bat:MSTest adapter 路径硬编码 3.0.4 → 通配符动态查找
  (包升级后不再失效)
2026-08-02 20:41:18 +08:00

30 lines
1.0 KiB
Batchfile

@echo off
setlocal
REM ============================================================
REM Deploy script. Tries to deploy with current user privileges first
REM (no UAC). Only elevates and retries if normal deployment fails
REM (e.g. target files are owned by Administrator).
REM Actual deployment logic is in deploy-body.ps1.
REM ============================================================
set "SCRIPT_DIR=%~dp0"
REM First attempt: deploy with current user permissions
pwsh -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%deploy-body.ps1"
if %ERRORLEVEL% EQU 0 (
echo Deployment succeeded without elevation.
exit /b 0
)
REM Normal deploy failed. Elevate and retry.
echo Deployment failed with current user permissions. Retrying with administrator rights...
pwsh -Command "Start-Process -FilePath 'pwsh.exe' -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','\"%SCRIPT_DIR%deploy-body.ps1\"' -Verb RunAs -Wait"
if errorlevel 1 (
echo Deployment failed.
exit /b 1
)
echo Plugin deployed successfully.
exit /b 0