@echo off REM ========================================================================== REM TAP — capture launcher for Windows (double-click me) REM ========================================================================== REM This tiny file exists only to relaunch tap-capture.ps1 as Administrator. REM Packet capture needs Administrator rights; the capture tool itself REM (pktmon) is BUILT INTO Windows 10/11 — no Npcap or driver install needed. REM REM When you double-click this file, Windows shows a UAC prompt asking to REM allow Administrator access. Click Yes; an elevated PowerShell window REM opens, records the capture, and opens the TAP dashboard. REM ========================================================================== REM Full path to the PowerShell script sitting next to this .bat. REM %~dp0 = the folder this .bat lives in (with a trailing backslash). set "PS1=%~dp0tap-capture.ps1" REM DOUBLE ANY APOSTROPHE IN THE PATH. The line below drops this value inside REM a PowerShell single-quoted string, and PowerShell escapes ' by doubling it REM — there is no backslash escape. A profile called O'Brien therefore broke REM the -Command text outright: Start-Process never ran, so there was no UAC REM prompt, no capture, and no error — the window just closed. Apostrophes are REM legal and common in Windows profile names. set "PS1=%PS1:'=''%" REM Ask PowerShell to relaunch itself elevated (-Verb RunAs = the UAC prompt), REM bypassing the execution policy just for this one script, and keeping the REM window open (-NoExit) so you can read the result. powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-NoExit','-File','\"%PS1%\"'"