JDownloader Community - Appwork GmbH
 

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12.04.2020, 19:44
sanchezvictor sanchezvictor is offline
I will play nice!
 
Join Date: Apr 2020
Posts: 3
Default Windows Batch>> Reconnect VPN for windows (OpenVPN)

Hi,
let me share with you my batch process with windows. The usage is simple:
the process look inside a directory, and randomly select one of the files with "ovpn" extension.

After that, kill the OpenVPN process, and start it again connection with the file choosen.

Hope you find this useful.

EDIT by pspzockerscene:
We recommend using the current/improved versions of that script, see posts of official JD staff below.
Here you can find the version initially posted by user "sanchezvictor":

Spoiler:

Code:
@ECHO OFF
SETLOCAL
SET "sourcedir=C:\Users\sanchezvictor\OpenVPN\config"
FOR /f %%a IN (
 'dir /b /a-d "%sourcedir%\*.ovpn"^|find /i /c ".ovpn" '
 ) DO SET /a selection=1 + (%RANDOM% %% %%a)
FOR /f "tokens=1*delims=:" %%a IN (
 'dir /b /a-d "%sourcedir%\*.ovpn"^|findstr /n /i ".ovpn" '
 ) DO IF %%a==%selection% SET filename=%%b
 
taskkill.exe /F /IM openvpn.exe
taskkill.exe /F /IM openvpn-gui.exe
timeout 1
start /b "" "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --silent_connection 1 --connect %filename%

GOTO :EOF

Last edited by pspzockerscene; 24.08.2021 at 18:04.
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 01:26.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.