@echo off :: Proxy Suite: remove the service and the program. The configuration and state stay in :: %ProgramData%\ProxySuite. net session >nul 2>&1 || ( powershell -NoProfile -Command "Start-Process -Verb RunAs -FilePath '%~f0'" exit /b ) :: One line: cmd reads a batch file line by line, and this one is deleted meanwhile. Out of :: the folder first: opened from Explorer, this window would hold it (and keep it there). cd /d "%SystemRoot%" & "%~dp0proxy-suite-service.exe" uninstall & pause & exit /b