JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #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.

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
Reply With Quote
  #2  
Old 16.04.2020, 19:07
hieunho hieunho is offline
Modem User
 
Join Date: Apr 2020
Posts: 2
Default

Can I use this right away? Or do I have to download OpenVNP and install it? Can I change the path of the config file?
Reply With Quote
  #3  
Old 19.04.2020, 19:53
sanchezvictor sanchezvictor is offline
I will play nice!
 
Join Date: Apr 2020
Posts: 3
Default

yes of course, you can change the path, and change tle VPN program for the pone you use
Reply With Quote
  #4  
Old 22.04.2020, 09:25
johnatan johnatan is offline
Modem User
 
Join Date: Apr 2020
Posts: 1
Default

As for my simple install another VPNs like Nord or Express like in this review **External links are only visible to Support Staff****External links are only visible to Support Staff**

Last edited by johnatan; 10.07.2020 at 10:00.
Reply With Quote
  #5  
Old 22.04.2020, 16:17
sanchezvictor sanchezvictor is offline
I will play nice!
 
Join Date: Apr 2020
Posts: 3
Default

first of all, if you are using OpenVPN, you can use NordVPN too. OpenVPN is just an open source client to connect with your VPN provider.

sencond, it doest matter what VPN provider you are using.You have to restart and select another Server because you need that your IP changes (otherwise you cannot continue downloading from mega or another file servers). It is the same as restart your router to get the IP changed.

This script is usefull for that purpouse: in case you have a private VPN provider (no matter which one) and in case you are usen OpenVPN as a client, you could have a directory in your PC with the "ovpn" files (the files you need to connect to one or another server) and randomly this script choose one to connect.
Reply With Quote
  #6  
Old 12.06.2021, 00:53
zr0cool zr0cool is offline
Modem User
 
Join Date: Jun 2021
Posts: 1
Default

Sorry to resurrect an old thread but wondering if anyone can help with this script.

When I try running this, I get an error saying 'cannot find requested config to autostart: %filename%'

Am I missing something? I changed the sourcedir to match the correct location.
Is there something else I need to be changing?

Thanks!
Reply With Quote
  #7  
Old 15.06.2021, 11:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 70,764
Default

Can you please share your script? screenshot?
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

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 09:44.
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 - 2021, Jelsoft Enterprises Ltd.