Back to articles

Using Mihomo + Metacubexd as Proxy on Windows

Some scripts and concepts are credited to the Linux.do community.

Mihomo Installation & Configuration

Install Mihomo via Scoop

For Scoop installation and configuration, see Scoop Installation and Configuration Guide.

bash
bucket add main
scoop install main/mihomo

Create Configuration File

Example configuration (config.yaml):

yaml
ipv6: false
external-controller: 0.0.0.0:9090
external-ui: ui
geodata-mode: true  # Enable .dat mode to show rule counts on the dashboard
geo-auto-update: true
geo-update-interval: 24
geox-url:
  geoip: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip-lite.dat"  # Lite version for smaller footprint
tun:
  enable: true
  auto-route: true
  auto-detect-interface: true
  strict-route: true
  stack: system
  dns-hijack:
    - 0.0.0.0:53
dns:
  enable: true
  listen: 0.0.0.0:53
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter:
    - '*.lan'
    - localhost.ptlogin2.qq.com
    - +.msftconnecttest.com
    - +.msftncsi.com
  nameserver:
    - system  # Use system DNS for best compatibility and speed
proxy-providers:
  XXX:
    type: http
    url: "XXX"  # Your subscription link
    path: ./XXX.yaml
    interval: 86400
proxy-groups:
  - name: "PROXY"
    type: select
    use:
      - XXX
rule-providers:
  global:
    type: http
    path: ./global.yaml
    url: "https://fastly.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ProxyLite.yaml"
    interval: 86400
    proxy: DIRECT
    behavior: classical
    format: yaml
  china:
    type: http
    path: ./china.yaml
    url: "https://fastly.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaDomain.yaml"
    interval: 86400
    proxy: DIRECT
    behavior: classical
    format: yaml
rules:
  - GEOIP,private,DIRECT,no-resolve  # Add 'no-resolve' before GEOIP rules to prevent premature DNS resolution
  - RULE-SET,global,PROXY,no-resolve
  - RULE-SET,china,DIRECT,no-resolve
  - GEOIP,cn,DIRECT
  - MATCH,PROXY

Alternatively, refer to the official documentation or community guides for custom configurations.

Create Launch Script

You can launch the .exe directly, or use a silent mihomo.vbs script (remember to update the paths):

Option A: With logging

vbs
set mihomo = CreateObject("WScript.Shell")
mihomo.CurrentDirectory = "D:\Software\Scoop\apps\mihomo\current"
mihomo.Run "cmd /c ""D:\Software\Scoop\apps\mihomo\current\mihomo.exe -d . > D:\Software\Scoop\apps\mihomo\current\mihomo.log 2>&1""", 0, false

Option B: No logging

vbs
set mihomo = CreateObject("WScript.Shell")
mihomo.CurrentDirectory = "D:\Software\Scoop\apps\mihomo\current"
mihomo.Run "mihomo.exe -d .", 1, true

Set Mihomo to Start on Boot

Create a shortcut for the VBS script above and move it to: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

MetaCubeXD Installation & Configuration

Go to the GitHub repo to download the Release, extract it, then create a .bat script in the extracted directory (or run python -m http.server every time):

batch
@echo off
REM Switch CMD code page to UTF-8 (65001) for correct character display
chcp 65001

REM Set the path for the website root directory
set WEB_ROOT=D:\metacubexd

REM Check and switch to the target path
echo Attempting to switch to directory: %WEB_ROOT%
cd /d "%WEB_ROOT%"
if %errorlevel% neq 0 (
    echo.
    echo ERROR: Could not switch to directory %WEB_ROOT%.
    echo Please verify the path exists.
    pause
    exit /b 1
)

REM Check for Python
where python >nul 2>nul
if %errorlevel% neq 0 (
    echo.
    echo ERROR: Python command not found.
    pause
    exit /b 1
)

REM Start HTTP Server
echo.
echo ----------------------------------------------------
echo 🎉 Python HTTP Server started successfully!
echo 🌐 URL: http://127.0.0.1:8000
echo 📁 Root Directory: %WEB_ROOT%
echo ----------------------------------------------------
echo.

REM Start server using default port 8000
python -m http.server 8000

REM Pause if server stops
echo.
echo HTTP Server has stopped.
pause

Done!

Postscript: Found two interesting projects: GUI.for.Clash and GUI.for.SingBox

clashdashboardmihomoproxyscoopwindowsbashyamlvbsbatch