Skip to content

Instantly share code, notes, and snippets.

@wfwei
Created June 21, 2013 09:21
Show Gist options
  • Select an option

  • Save wfwei/5830013 to your computer and use it in GitHub Desktop.

Select an option

Save wfwei/5830013 to your computer and use it in GitHub Desktop.
Windows命令行链接和断开vpn
public static void changIP() {
try {
System.out.println("Disconnecting...");
Runtime.getRuntime().exec("rasdial myVpn /disconnect");
System.out.println("Sleep for 10 seconds");
Thread.sleep(10000);
System.out.println("Connectiong..");
Runtime.getRuntime().exec("rasdial myVpn wfwei wangfengwei");
System.out.println("Over");
} catch (Exception e) {
LOG.error("Fail to change IP:" + e.getMessage());
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment