@echo off
::	run this batch file THEN the Windows PIA app!
::	obtains PIA WireGuard config from *.conf file written to disk
::	opens up the *.conf file in notepad with config info
::	NOTE: the default PIA app installation directory

set DIRECTORY=C:\Program Files\Private Internet Access
set PC="a.conf"
set PIA="%DIRECTORY%\data\w*.conf"

start "PIA" "%DIRECTORY%\pia-client.exe"
timeout /t 2 /nobreak
"%DIRECTORY%\piactl.exe" disconnect
"%DIRECTORY%\piactl.exe" connect

if exist %PC% del %PC% > nul
:START
	echo .
	if exist %PIA% copy %PIA% %PC% > nul
	if exist %PC% notepad %PC%
	if exist %PC% goto END
	goto START
:END
	if exist %PC% del %PC% > nul