Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: Usage
- :: WS-Connect.cmd
- ::
- :: WS-Connect - connects to the next location in the list
- :: WS-Connect ranodom - connects to a random location in the list
- ::
- :: Build the list
- setlocal enabledelayedexpansion
- :: List of locations, you can use country code (CA), a city (Toronto), or server (Prague Staromak)
- Set Country=CA/Toronto/Prague Staromak
- :: I found this in the internet and don't understand it. It appears
- :: to loop over each element and create a variable called element[i]
- set i=1
- set "element[!i!]=%country:/=" & set /A i+=1 & set "element[!i!]=%"
- :: debug
- set element
- Set MaxCity=!i!
- echo maxcity - %maxcity%
- echo country=%country%
- set index=0
- :: If no parameter, loop through locations
- If %1.==. goto :reconnect
- :OneRandom
- :: Any option on the command picks a single location at random and connects
- :: %random% returns a value between 0-32768. We are taking the modulus. This
- :: results in a number between 0-(maxcity-1) so we have to add one.
- :: we now have a number %in% between 1 and maxcity
- SET /A in=%RANDOM% %% %Maxcity% + 1
- "C:\Program Files\Windscribe\windscribe-cli.exe" connect !element[%in%]!
- goto :exit
- :reconnect
- :: Reconnect to the next location in the list every 45 minutes
- echo reconnect
- pause
- echo index=%index%
- set /a in=%index% + 1
- "C:\Program Files\Windscribe\windscribe-cli.exe" connect !element[%in%]!
- set /a index+=1
- set /a index=%index% %% %MaxCity%
- Timeout /T 2700
- goto :reconnect
- :exit
Advertisement
Add Comment
Please, Sign In to add comment