27 lines
872 B
Batchfile
27 lines
872 B
Batchfile
@echo off
|
|
:: ==========================================
|
|
:: 自动化装机工具启动器
|
|
:: ==========================================
|
|
|
|
:: 1. 强制切换到当前批处理文件所在的目录
|
|
:: 这一步至关重要,防止以管理员身份运行时路径变成了 C:\Windows\System32
|
|
cd /d "%~dp0"
|
|
|
|
:: 2. 检查管理员权限
|
|
if not "%1" == "am_admin" (
|
|
rem you'd better keep the following line as it is.
|
|
powershell start -verb runas '%0' am_admin & exit /b
|
|
)
|
|
|
|
:: ==========================================
|
|
:: 3. 核心执行逻辑
|
|
:: ==========================================
|
|
|
|
echo Calling main.ps1...
|
|
|
|
:: -NoProfile: 不加载用户配置文件,加快启动速度
|
|
:: -ExecutionPolicy Bypass: 绕过默认的脚本执行策略限制
|
|
:: -File: 指定要运行的脚本文件
|
|
|
|
powershell.exe -NoExit -NoProfile -ExecutionPolicy Bypass -File ".\main.ps1"
|