@echo off set CURRENTDIR=%~dp0 :: Stop OpenVPNService sc stop OpenVPNService copy /Y "%CURRENTDIR:~0,-1%\BNVB-Ingenieure-VPN.ovpn" "%PROGRAMFILES%\OpenVPN\config-auto\" :: sleep before starting the service ping 127.0.0.1 -n 10 -w 1000 > NUL :: Start OpenVPNService sc start OpenVPNService