-
Notifications
You must be signed in to change notification settings - Fork 0
/
检查运行环境.cmd
35 lines (34 loc) · 1.47 KB
/
检查运行环境.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@echo off
cd %~dp0
if not exist main.ps1 (
echo 未找到一份有效的 PallasBot-Helper 安装(是否已经解压?)
pause
goto :EOF
)
setlocal enabledelayedexpansion
set POWERSHELL_EXEC=powershell
!POWERSHELL_EXEC! -NoLogo -NoProfile -Command exit
if errorlevel 1 (
set POWERSHELL_EXEC=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
!POWERSHELL_EXEC! -NoLogo -NoProfile -Command exit
if errorlevel 1 (
echo 警告:找不到系统组件powershell,这可能代表系统已经损坏。正在使用pwsh
set POWERSHELL_EXEC=pwsh
!POWERSHELL_EXEC! -NoLogo -NoProfile -Command exit
if errorlevel 1 (
set POWERSHELL_EXEC=C:\Program Files\PowerShell\7\pwsh.exe
!POWERSHELL_EXEC! -NoLogo -NoProfile -Command exit
if errorlevel 1 (
echo 错误:找不到pwsh,请访问 https://aka.ms/powershell-release?tag=stable 手动安装PowerShell 7 后重试
echo 按任意键后将尝试打开下载页面(通常你需要下载并安装PowerShell-x.x.x-win-x64.msi)
pause
rundll32 url.dll,FileProtocolHandler https://aka.ms/powershell-release?tag=stable
exit
)
)
)
)
!POWERSHELL_EXEC! -noprofile -command "&{ start-process powershell -ArgumentList {-Command 'set-ExecutionPolicy Bypass' } -verb RunAs }"
!POWERSHELL_EXEC! -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\main.ps1 -t
echo "任务结束"
pause