← Back to Notes
ngrokJuly 2, 2026

How to Auto-Start ngrok on Windows Login

Use this once you've confirmed your ngrok tunnel works manually, and you're tired of retyping the command every time you log into Windows.

Steps

  1. Create a new file named start-ngrok.bat somewhere permanent, like your project folder.
  2. Open it in a text editor and paste in:
    @echo off
    ngrok http --url=yourdomain.ngrok-free.dev 5678
    
    (replace the domain and port with your actual values)
  3. Save the file.
  4. Press Win + R, type shell:startup, press Enter. This opens Windows' Startup folder.
  5. Right-click inside that folder → New → Shortcut.
  6. Browse to and select your start-ngrok.bat file, click Finish.

Gotcha

Double check the batch file syntax carefully, specifically that it says ngrok (not a typo like grok) and that the URL flag is written as --url=yourdomain.ngrok-free.dev, not just the bare domain after http. A small typo here fails silently, the terminal window just opens and closes or errors out, easy to miss if you're not watching for it.

Quick reference

@echo off
ngrok http --url=yourdomain.ngrok-free.dev PORT

Test with a full restart, not just closing and reopening a terminal, to confirm the shortcut actually fires on login.