# One-click user install (no admin required). $ErrorActionPreference = 'Stop' $Root = Split-Path -Parent $MyInvocation.MyCommand.Path $Dest = Join-Path $env:LOCALAPPDATA 'rclone-dropbox-bisync' New-Item -ItemType Directory -Force -Path (Join-Path $Dest 'bin') | Out-Null Copy-Item -Force (Join-Path $Root 'rclone.exe') (Join-Path $Dest 'bin\rclone.exe') Copy-Item -Force (Join-Path $Root 'rclone-bisyncd.exe') (Join-Path $Dest 'bin\rclone-bisyncd.exe') Copy-Item -Force (Join-Path $Root 'tray.ps1') (Join-Path $Dest 'tray.ps1') $cfg = Join-Path $Dest 'config.json' if (-not (Test-Path $cfg)) { Copy-Item (Join-Path $Root 'config.example.json') $cfg $j = Get-Content $cfg -Raw | ConvertFrom-Json $j.rclone = Join-Path $Dest 'bin\rclone.exe' $j | ConvertTo-Json | Set-Content -Encoding UTF8 $cfg } $bin = Join-Path $Dest 'bin' $userPath = [Environment]::GetEnvironmentVariable('Path', 'User') if ($userPath -notlike "*$bin*") { [Environment]::SetEnvironmentVariable('Path', "$bin;$userPath", 'User') } $run = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run' New-ItemProperty -Path $run -Name 'rclone-dropbox-bisync' -PropertyType String -Force ` -Value "powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$Dest\tray.ps1`"" | Out-Null schtasks /Create /F /TN "rclone-dropbox-bisync" /SC MINUTE /MO 15 /TR ` "`"$Dest\bin\rclone-bisyncd.exe`" --once" /ST 00:00 | Out-Null Start-Process powershell.exe -WindowStyle Hidden -ArgumentList @( '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', (Join-Path $Dest 'tray.ps1') ) Add-Type -AssemblyName PresentationFramework [System.Windows.MessageBox]::Show("Installed to $Dest`r`nEdit config.json (enabled, path1, path2, workdir).`r`nPut RCLONE_TEST on both sides. Tray + 15-min task are on.", 'rclone-dropbox-bisync')