26 lines
826 B
Batchfile
26 lines
826 B
Batchfile
@echo off
|
|
chcp 936 >nul
|
|
title 成套报价 CAD 插件安装程序
|
|
|
|
REM 切换到批处理文件所在目录(支持从任意位置运行)
|
|
cd /d "%~dp0"
|
|
|
|
REM 检查 PowerShell 脚本是否存在
|
|
if not exist "安装CAD插件.ps1" (
|
|
echo [错误] 未找到 安装CAD插件.ps1
|
|
echo 请确保本批处理文件与 安装CAD插件.ps1 在同一目录。
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM 以管理员身份运行 PowerShell 脚本(避免 HKLM 写入提权弹窗中断)
|
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process powershell -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','%~dp0安装CAD插件.ps1' -Verb RunAs -Wait"
|
|
|
|
REM 若用户取消提权,则非提权运行(HKLM 写入会自动提权,acaddoc.lsp 和 TRUSTEDPATHS 无需管理员)
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo [提示] 管理员提权被取消,尝试非提权运行...
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "安装CAD插件.ps1"
|
|
)
|
|
|
|
pause |