Skip to content

Instantly share code, notes, and snippets.

@DerexScript
Created July 26, 2026 23:27
Show Gist options
  • Select an option

  • Save DerexScript/762753de538cfd0f057a9ea7d4fc4f64 to your computer and use it in GitHub Desktop.

Select an option

Save DerexScript/762753de538cfd0f057a9ea7d4fc4f64 to your computer and use it in GitHub Desktop.
A simple tool that toggles between opening and closing Hamachi—handling both the executable and the services.
@echo off
set "SERVICO=Hamachi2Svc"
set "SERVICO2=LMIGuardianSvc"
set "HAMACHI_UI=C:\Program Files (x86)\LogMeIn Hamachi\hamachi-2-ui.exe"
:: Para o serviço se estiver rodando
sc config "%SERVICO%" start= demand >nul
sc.exe query "%SERVICO%" | find /I "RUNNING" >nul
if errorlevel 0 if not errorlevel 1 (
echo Parando Hamachi Tunneling Engine...
net stop "%SERVICO%"
)
sc config "%SERVICO2%" start= demand >nul
sc.exe query "%SERVICO2%" | find /I "RUNNING" >nul
if errorlevel 0 if not errorlevel 1 (
echo Parando Support LogMeIn processes with quality assurance feedback...
net stop "%SERVICO2%"
)
echo .
echo .
echo Deseja abrir o Hamachi?
pause
:: Garante que o serviço fique em modo manual
:: sc.exe config "%SERVICO%" start= demand >nul
:: Inicia o serviço se não estiver rodando
sc config "%SERVICO%" start= demand >nul
sc.exe query "%SERVICO%" | find /I "RUNNING" >nul
if errorlevel 1 (
echo Iniciando Hamachi Tunneling Engine...
net start "%SERVICO%"
)
:: Inicia o serviço se não estiver rodando
sc config "%SERVICO2%" start= demand >nul
sc.exe query "%SERVICO2%" | find /I "RUNNING" >nul
if errorlevel 1 (
echo Iniciando Support LogMeIn processes with quality assurance feedback...
net start "%SERVICO2%"
)
:: Abre a interface do Hamachi
tasklist /FI "IMAGENAME eq hamachi-2-ui.exe" /NH | find /I "hamachi-2-ui.exe" >nul
if errorlevel 1 (
start "" "%HAMACHI_UI%"
)
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment