Windows SSH Setup with Plink and Batch files

Last updated by Shayne M on May 22, 2013 10:28

You can connect an SSH tunnel via the command line in windows using the freeware "Plink" tool. You can also use a simple batch file to automate this connection process.

We have attached a zip file containing the latest development version of the Plink tool (as of 1/1/12), and an example batch file to connect to our servers. The batch file code is as follows:

rem First attempt at windows batch file to control plink for SSHT<br>@echo off<br>set /p username=What is your VPNSecure username ? <br>set /p password=What is your VPNSecure password ? <br>set /p server=What server do you want to connect to ? (eg: au1) <br>plink.exe -P 443 -l %username% -pw %password% -D 8080 -4 -C -N %server%.vpnsecure.me

You just need to put this batch file and plink in the same folder, and run the batch file. It will ask for a username, password and server address to connect to and set up the connection which opens a socks5 proxy on your localhost at port 8080.

You could easily edit this batch file to hardcode in your username, password and server address - or change what port the socks proxy listens on locally making this solution perfect for automation or connecting on startup.

Once the server is up you would just configure your internet applications to use this socks proxy.

We have setup guides available for common browsers here:

Complete Automation Example

You could make a batch file containing the following to completely automate connection, perfect for running on computer startup by modifying the following code with your own username, password and server address:

plink.exe -P 443 -l <em><strong>username</strong></em> -pw <em><strong>password</strong></em> -D 8080 -4 -C -N <em><strong>server</strong></em>.vpnsecure.me

VPNSecure Provides Secure VPN servers in over 45+ Countries

If you are a looking for a versatile easy to use VPN service, checkout Today