@echo off
if not "%1"=="Ex" goto wrap
set f=%~dp0\MCEdit.exe
set errorlevel=1
if exist "%f%" netsh advfirewall firewall delete rule name=all program="%f%" >nul 2>nul
if exist "%f%" netsh advfirewall firewall add rule name="MCEdit.exe" dir=in action=allow program="%f%" enable=yes description="%f%"
if errorlevel 1 (echo 操作失败，请尝试右键“以管理员身份运行”) else echo 操作成功
pause
goto :eof

:wrap
start "Add Firewall Exception / 添加防火墙例外" "%~0" Ex
