My client want me to connect and disconnect from an internet connection automatically.

How can I do that? can we do that from batch files? Is there an API to do so>?