My application starts openvpn from the command line like this:
Dim cmdInfo As New ProcessStartInfo("cmd", "/K openvpn.exe " & Chr(34) & ovpnPath & Chr(34))
cmdInfo.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(cmdInfo)
This works great but I have no way of closing openvpn gracefully. I could kill the process but then it doesn't remove the routes etc.
Now I'm looking for a way to send Ctrl+C or F4 to my hidden cmd window to make OpenVPN exit.