Click here to Skip to main content
16,004,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

in my .net application i wanted to programatically invoke the cisco vpn connection for that i wanted to run multiple command prompt commands in c# code
i have to run 3 commands like this-
1-cd C:\Program Files (x86)\Cisco Systems\VPN Client
2-vpnclient connect user USERNAME pwd PASSWORD "VPNNAME"
3-vpnclient disconnect

starting i want to run first two commands then after that 3rd one, can we do this in a single process or how it is . i tried by putting two commands together by seperated by & in a process startinfo arguments, but getting error like "unable to connect to remote machine"
Please help

Regards
Ginnas
Posted

1 solution

You don't need step 1, since on a process start, you can supply working directory. For how to start an external process, look here: http://www.dotnetperls.com/process-start[^] (more details on MSDN[^]). You don't need command prompt for that, just start your processes. As these end when finished, simply check for errors.
But you could use the Cisco VPN api[^] instead of this approach. It would be more elegant. I don't know about a c# wrapper but you might find some on the web. But since you need only a few calls, you could make your own p/invoke declarations for those methods.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900