# Install prontaro CLI on Windows

Source: https://prontaro.com/docs/cli/windows/

Install prontaro.exe on Windows through PowerShell with no admin rights, built-in SHA256 verification, and Task Scheduler auto-start.

`prontaro.exe` works in PowerShell, Windows Terminal, and Command Prompt on Windows 10, Windows 11, and Windows Server (`amd64` and `arm64`).

## Quick install (PowerShell)

Open PowerShell and run the official installer ([install.ps1](https://prontaro.com/install.ps1)):

```powershell
irm https://prontaro.com/install.ps1 | iex
```

The script reads the latest version from [latest.json](https://dl.prontaro.net/cli/latest.json), downloads `prontaro_windows_<arch>.zip` and `SHA256SUMS` over HTTPS, and verifies the SHA256 checksum.

It then extracts `prontaro.exe` into `%LOCALAPPDATA%\Programs\prontaro\prontaro.exe` and adds that folder to your user `PATH`—no UAC prompt or admin rights required.

To pin a specific version:

```powershell
$env:PRONTARO_VERSION = '0.2.0'; irm https://prontaro.com/install.ps1 | iex
```

> **Windows SmartScreen and Authenticode signing**
>
> `prontaro.exe` is currently distributed unsigned (no Authenticode publisher certificate), so Windows Defender SmartScreen may show a blue *“Windows protected your PC”* dialog on first run.
>
> Do not disable Windows Defender or SmartScreen. Verify the archive’s SHA256 checksum against `SHA256SUMS` first (below), then click **More info → Run anyway** once the hash matches.

## Manual download and SHA256 verification

Fetch the current version from [latest.json](https://dl.prontaro.net/cli/latest.json), download the `.zip` archive (`amd64` or `arm64`) with `SHA256SUMS`, and verify the digest via `Get-FileHash`:

```powershell
$Version = (Invoke-RestMethod "https://dl.prontaro.net/cli/latest.json").version
$Arch    = "amd64" # or arm64
$Zip     = "prontaro_windows_$Arch.zip"

Invoke-WebRequest "https://dl.prontaro.net/cli/v$Version/$Zip" -OutFile $Zip
Invoke-WebRequest "https://dl.prontaro.net/cli/v$Version/SHA256SUMS" -OutFile SHA256SUMS

$Got  = (Get-FileHash .\$Zip -Algorithm SHA256).Hash.ToLower()
$Want = (Select-String -Path .\SHA256SUMS -SimpleMatch $Zip).Line.Split()[0].ToLower()
if ($Got -eq $Want) { "OK: $Got" } else { throw "Checksum mismatch: $Got != $Want" }
```

Extract `prontaro.exe` into `%LOCALAPPDATA%\Programs\prontaro` and add that folder to your user `PATH`:

```powershell
$Dest = "$env:LOCALAPPDATA\Programs\prontaro"
Expand-Archive .\$Zip -DestinationPath $Dest -Force

$UserPath = [Environment]::GetEnvironmentVariable('Path', 'User')
if (-not (($UserPath -split ';') -contains $Dest)) {
  [Environment]::SetEnvironmentVariable('Path', "$UserPath;$Dest".TrimStart(';'), 'User')
}
```

## Sign in and state directory

Open a fresh PowerShell window (or keep using the current one after `install.ps1`) and run `prontaro login`—it opens your browser to confirm sign-in automatically:

```powershell
prontaro version
prontaro login --label win-workstation
prontaro status
prontaro doctor
```

See [CLI overview](https://prontaro.com/docs/cli/overview.md) for manual `--token` login and CI usage, and [Diagnostics and error codes](https://prontaro.com/docs/cli/errors.md) for every `doctor` check.

## Enable PowerShell completion

To load tab completion in your current PowerShell session:

```powershell
prontaro completion powershell | Out-String | Invoke-Expression
```

To enable it in every new PowerShell window, append that line to your PowerShell `$PROFILE` file.

## Auto-start on Windows with Task Scheduler

Windows has no `prontaro service`. To start a tunnel automatically in the background (with no console window) at sign-in, register a Task Scheduler task. Sign in first as the same Windows user (`prontaro login`).

Next, create a `.ps1` wrapper and register the task without an execution time limit (`-ExecutionTimeLimit (New-TimeSpan -Seconds 0)`): otherwise Windows automatically terminates the tunnel after 72 hours:

```powershell
$Dir = "$env:LOCALAPPDATA\prontaro"
New-Item -ItemType Directory -Path $Dir -Force | Out-Null

# Wrapper script: logs go to a size-rotated file (10 MiB x 3)
@'
$env:PRONTARO_LOG_FILE = "$env:LOCALAPPDATA\prontaro\tunnel-api.log"
& "$env:LOCALAPPDATA\Programs\prontaro\prontaro.exe" http 3000 --name api --no-input
exit $LASTEXITCODE
'@ | Set-Content -Path "$Dir\run-api.ps1" -Encoding UTF8

$Action = New-ScheduledTaskAction `
  -Execute "powershell.exe" `
  -Argument "-WindowStyle Hidden -NonInteractive -NoProfile -File `"$Dir\run-api.ps1`""
$Trigger = New-ScheduledTaskTrigger -AtLogOn
$Settings = New-ScheduledTaskSettingsSet `
  -ExecutionTimeLimit (New-TimeSpan -Seconds 0) `
  -AllowStartIfOnBatteries `
  -DontStopIfGoingOnBatteries `
  -RestartCount 3 `
  -RestartInterval (New-TimeSpan -Minutes 1)

Register-ScheduledTask -TaskName "ProntaroTunnelApi" `
  -Action $Action -Trigger $Trigger -Settings $Settings -Force
Start-ScheduledTask -TaskName "ProntaroTunnelApi"
```

With `--no-input`, `prontaro` disables prompts and exits immediately with a non-zero exit code on startup refusals (such as an unpaid or blocked account); `exit $LASTEXITCODE` passes that code to Task Scheduler so its failure-restart setting (`-RestartCount` and `-RestartInterval`, or **If the task fails, restart every…** in the Task Scheduler UI) retries automatically.

Inspect status, follow logs, stop, or remove the task:

```powershell
schtasks /Query /TN "ProntaroTunnelApi" /V /FO LIST
Get-Content "$env:LOCALAPPDATA\prontaro\tunnel-api.log" -Tail 40 -Wait
schtasks /End /TN "ProntaroTunnelApi"
schtasks /Delete /TN "ProntaroTunnelApi" /F
```

> **Never add --takeover to a scheduled task**
>
> A scheduled task with `--takeover` steals the tunnel back from another machine on every restart. Take ownership once in a terminal, stop that session, and run the scheduled task without `--takeover`.

## Tip for WSL2 users

If your local app or database runs inside WSL2, install the native Linux `prontaro` binary inside your WSL2 distribution using the [Linux guide](https://prontaro.com/docs/cli/linux.md).

That avoids Windows-to-WSL port forwarding quirks and lets you run background tunnels with `systemd` when `systemd=true` is enabled in `/etc/wsl.conf`.

## Update and uninstall

### Update

Update in place with `prontaro update` (or re-run `install.ps1`):

```powershell
prontaro update
```

You can update while `prontaro.exe` is running: active tunnels and scheduled tasks switch to the new version when you restart them.

### Uninstall

Stop and delete any scheduled tasks, sign out (`prontaro logout`), and remove the executable and state folders:

```powershell
prontaro logout
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\Programs\prontaro"
Remove-Item -Recurse -Force "$env:APPDATA\prontaro"
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\prontaro" -ErrorAction SilentlyContinue
```

Remove `%LOCALAPPDATA%\Programs\prontaro` from your user `PATH` under *System Properties → Environment Variables* if desired.

## Troubleshooting

- **`prontaro` is not recognized after installation:** Open a new PowerShell or Windows Terminal window so the updated user `PATH` takes effect.
- **Corporate proxy or TLS error:** Test with `$env:HTTPS_PROXY = "http://proxy.example.com:3128"; prontaro doctor` and confirm automatic time sync is enabled in *Settings → Time & language*.

## Next steps

- [Open your first HTTPS tunnel in 2 minutes](https://prontaro.com/docs/start/tunnel.md) — expose a local web server over a permanent HTTPS address.
- [prontaro CLI command reference](https://prontaro.com/docs/cli/commands.md) — every subcommand and global flag with terminal examples.
- [Diagnostics and error codes](https://prontaro.com/docs/cli/errors.md) — troubleshooting with `prontaro doctor` and CLI exit codes.
