fix option 4 not redirecting to menu : @echo off setlocal enabledelayedexpansion…
- User
fix option 4 not redirecting to menu : @echo off setlocal enabledelayedexpansion
:fixer_menu rem Define variables set "ruleName=hola" set "softwareName=AndroidEmulatorEn" set "executablePath=" set "lastStatus="
:check_firewall rem Check if the firewall is enabled netsh advfirewall show allprofiles state | find "State" | find "ON" >nul if %errorlevel% neq 0 ( cls echo Windows Firewall is disabled. Please enable the firewall to use this fixer. pause goto fixer_menu )
:check_process rem Check if the process is running and get the path for /f "tokens=2 delims=," %%i in ('wmic process where "name='AndroidEmulatorEn.exe'" get ExecutablePath /format:csv ^| find /I "AndroidEmulatorEn.exe"') do ( set "executablePath=%%~i" )
rem If the path was not found, show warning if "%executablePath%"=="" ( cls echo Gameloop is not running. Please ensure it is running. echo. echo The fixer menu will still be available, but actions may not work correctly. echo. pause )
:display_menu cls call :check_rule_status call :display_status echo. echo Select an option: echo 1. Start Fixer echo 2. Stop Fixer echo 3. No match found fix echo 4. Main menu
:wait_for_input rem Wait for user input or check status every second choice /C 1234 /N /T 1 /D 4 >nul
if errorlevel 4 ( call :check_rule_status if "!currentStatus!" neq "!lastStatus!" ( goto display_menu ) goto wait_for_input ) if errorlevel 3 ( call :no_match_fix goto display_menu ) if errorlevel 2 ( call :stop_fixer goto display_menu ) if errorlevel 1 ( call :start_fixer goto display_menu )
goto wait_for_input
:check_rule_status netsh advfirewall firewall show rule name="%ruleName%" >nul 2>&1 if %errorlevel% equ 0 ( set "currentStatus=on" ) else ( set "currentStatus=off" ) exit /b
:display_status if "%currentStatus%"=="on" ( color 2F echo Current Status : Fixer on ) else ( color 4F echo Current Status : Fixer off ) set "lastStatus=%currentStatus%" exit /b
:start_fixer echo Starting Fixer.. netsh advfirewall firewall add rule name="%ruleName%" protocol=TCP remoteport=9031,443,8700,8013,20002,80,8088,8086,9030,20000,10427,9031,10012,10012,17500 dir=out action=block program="%executablePath%" powershell -c "[console]::beep(1000,500)" >nul 2>&1 timeout /t 2 >nul exit /b
:stop_fixer netsh advfirewall firewall delete rule name="%ruleName%" >nul 2>&1 powershell -c "[console]::beep(1000,500)" >nul 2>&1 timeout /t 2 >nul exit /b
:no_match_fix echo Fixing... netsh advfirewall firewall add rule name="%ruleName%" protocol=TCP remoteport=9031,443,8700,8013,20002,80,8088,8086,9030,20000,10427,9031,10012,10012,17500 dir=out action=block program="%executablePath%" powershell -c "[console]::beep(1000,500)" >nul 2>&1 timeout /t 3 >nul netsh advfirewall firewall delete rule name="%ruleName%" >nul 2>&1 powershell -c "[console]::beep(1000,500)" >nul 2>&1 timeout /t 2 >nul exit /b
- Assistant
The issue with option 4 not redirecting to the main menu in your batch script appears to be related to the way the choice handling and the menu structure are set up. Currently, when option 4 is selected, the script goes back to waiting for user input or checking status with
:wait_for_input. To rectify this, we need to properly utilizegototo redirect to the:fixer_menu.Here's how you can fix this issue:
- Update the redirection for option 4 to point properly back to the
:fixer_menu.
Here is the corrected portion of your script:
:wait_for_input rem Wait for user input or check status every second choice /C 1234 /N /T 1 /D 4 >nul if errorlevel 4 ( goto fixer_menu ) if errorlevel 3 ( call :no_match_fix goto display_menu ) if errorlevel 2 ( call :stop_fixer goto display_menu ) if errorlevel 1 ( call :start_fixer goto display_menu ) goto wait_for_inputThis change ensures that selecting option 4 will bring you back to the by using , effectively refreshing the menu as intended.
- Update the redirection for option 4 to point properly back to the
- User
still not working
- Assistant
- User
still not working
- Assistant