Skip to content

Instantly share code, notes, and snippets.

@koloved
Created March 31, 2025 12:14
Show Gist options
  • Save koloved/8a8dda69b9560b329c3ddcf81295d08d to your computer and use it in GitHub Desktop.
Save koloved/8a8dda69b9560b329c3ddcf81295d08d to your computer and use it in GitHub Desktop.
Block RAWMHUB updates bat script
@echo off
setlocal enabledelayedexpansion
:: Check for command-line arguments
if not "%~1"=="" goto PROCESS_ARG
:: Initial menu without admin rights
:MENU
cls
echo Select action:
echo 1 - Block RAWMHUB updates
echo 2 - Unblock RAWMHUB updates
set /p choice="Enter 1 or 2: "
IF "%choice%"=="1" goto ELEVATE
IF "%choice%"=="2" goto ELEVATE
echo Invalid input. Press any key to try again...
pause >nul
goto MENU
:: Relaunch with admin rights and user choice
:ELEVATE
powershell -Command "Start-Process cmd -ArgumentList '/c ""%~dpnx0"" %choice%' -Verb RunAs"
exit /b
:: Admin-required operations
:PROCESS_ARG
NET SESSION >nul 2>&1 || (
echo Error: Administrator privileges required.
pause
exit /b
)
:: Execute chosen action
if "%1"=="1" goto BLOCK
if "%1"=="2" goto UNBLOCK
echo Invalid parameter. Use 1 (block) or 2 (unblock)
exit /b
:BLOCK
set "appPath=C:\Users\%USERNAME%\AppData\Local\Programs\RAWMHUB\RAWMHUB.exe"
IF NOT EXIST "%appPath%" (
echo Error: RAWMHUB.exe not found at
echo "%appPath%"
pause
exit /b
)
netsh advfirewall firewall add rule name="Block RAWMHUB Outbound" dir=out action=block program="%appPath%" enable=yes
netsh advfirewall firewall add rule name="Block RAWMHUB Inbound" dir=in action=block program="%appPath%" enable=yes
echo Successfully BLOCKED RAWMHUB updates
goto END
:UNBLOCK
netsh advfirewall firewall delete rule name="Block RAWMHUB Outbound" >nul 2>&1
netsh advfirewall firewall delete rule name="Block RAWMHUB Inbound" >nul 2>&1
echo Successfully UNBLOCKED RAWMHUB updates
:END
echo Operation completed. Press any key to exit...
pause >nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment