# PhoneRC web installer — generated from phone-rc/shortcut-launcher. # Do not edit here; edit the source in the phone-rc repository. $ErrorActionPreference = "Stop" $InstallDir = if ($env:PHONERC_COMPANION_HOME) { $env:PHONERC_COMPANION_HOME } else { Join-Path $env:LOCALAPPDATA "PhoneRC Companion" } $StartupDir = [Environment]::GetFolderPath("Startup") # Stop any running PhoneRC listeners (Python companion and/or AutoHotkey script). Get-CimInstance Win32_Process -Filter "Name='pythonw.exe' OR Name='python.exe'" | Where-Object { $_.CommandLine -like '*PhoneRC Companion*' -or $_.CommandLine -like "*$InstallDir*" } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue } Get-CimInstance Win32_Process -Filter "Name LIKE 'AutoHotkey%'" | Where-Object { $_.CommandLine -like '*phonerc_shortcuts.ahk*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue } Start-Sleep -Milliseconds 500 # Remove autostart entries (both modes). foreach ($name in @("PhoneRC Companion.cmd", "PhoneRC Shortcuts.cmd", "PhoneRC Shortcuts.lnk")) { $p = Join-Path $StartupDir $name if (Test-Path $p) { Remove-Item $p -Force; Write-Host "Removed autostart: $p" } } # Remove the install directory. if (Test-Path $InstallDir) { Remove-Item $InstallDir -Recurse -Force Write-Host "Removed: $InstallDir" } Write-Host "PhoneRC Companion uninstalled." Write-Host "(AutoHotkey itself, if you installed it, is left in place.)"