---
# System prepended metadata

title: Ngrok
tags: [linux, script, windows]

---

# 
###### `script`

``` batch
powershell -NoProfile -Command "$u=(Invoke-RestMethod 'http://127.0.0.1:4040/api/tunnels').tunnels.public_url|?{$_ -like 'https://*.ngrok-free.app*'}|Select-Object -First 1; if($u){telegram -m $u}"

```

``` shell
ngrok http 80 > /tmp/ngrok80.log &
ngrokURL=$(curl -s http://127.0.0.1:4040/api/tunnels | grep -oE 'https://[^"]+\.ngrok-free\.app' | head -n 1)
[ -n "$ngrokURL" ] && telegram -m "$ngrokURL"
echo $ngrokURL
```