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
- Create a new file named
start-ngrok.batsomewhere permanent, like your project folder. - Open it in a text editor and paste in:
(replace the domain and port with your actual values)@echo off ngrok http --url=yourdomain.ngrok-free.dev 5678 - Save the file.
- Press Win + R, type
shell:startup, press Enter. This opens Windows' Startup folder. - Right-click inside that folder → New → Shortcut.
- Browse to and select your
start-ngrok.batfile, 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.