-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProxy.bat
More file actions
27 lines (23 loc) · 737 Bytes
/
Copy pathProxy.bat
File metadata and controls
27 lines (23 loc) · 737 Bytes
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
@echo off
title Proxy Core Manager
rem ==== Run as Administrator (TUN / system proxy / autostart need it; only one UAC) ====
net session >nul 2>&1
if %errorlevel% neq 0 (
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
rem ==== Go to the script directory ====
cd /d "%~dp0"
rem ==== Prefer PowerShell 7 (pwsh), fall back to Windows PowerShell ====
where pwsh >nul 2>&1
if %errorlevel%==0 (
pwsh -NoProfile -ExecutionPolicy Bypass -File "%~dp0Proxy.ps1"
) else (
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Proxy.ps1"
)
rem ==== Keep window open on abnormal exit ====
if errorlevel 1 (
echo.
echo [!] Script exited abnormally. Code: %errorlevel%
pause
)