DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   DOS "ROUTE" command (http://www.daniweb.com/forums/thread1072.html)

JCSAYRE Sep 10th, 2003 7:22 pm
DOS "ROUTE" command
 
Does anyone know of a way to invoke the DOS "ROUTE" command(s). I have written a .bat program that adds routes, but I want to take a particular interface from my ROUTE PRINT output and then ROUTE ADD the routes to that interface. Since that interface is dynamic due to VPN issues, it would be great if I could write a little program that would first determine the interface ID (such as 0x2000005) and then create the routes via ROUTE ADD. TIA.

-jcs

Tekmaven Oct 9th, 2003 7:02 pm
Re: DOS "ROUTE" command
 
I think I'm missing something... Where is your question? hehe

JCSAYRE Oct 9th, 2003 8:21 pm
Re: DOS "ROUTE" command
 
It's been brought to my attention that my quetion isn't very clear, which I have to agree with. Here's my question:
In Vis.Basic, how can I determine the active interfaces on my computer? I can do this with the DOS command, "ROUTE PRINT" but I would like to be able to do something like the following psuedo-code:

DIM WAN, TEMP AS STRING
DIM IPADDRESS, GATEWAY AS STRING

IPADDRESS = "1.2.3.4" 'YES I KNOW THIS IS A BOGUS IP ADDY
GATEWAY = "5.6.7.8" ''YES I KNOW THIS IS A BOGUS IP ADDY TOO

TEMP = ROUTE PRINT | FIND "WAN"
WAN = MID (TEMP,2,7)
ROUTE ADD IPADDRESS GATEWAY METRIC 2 IF (THIS IS INTERFACE, NOT "IF" STATEMENT) WAN

What I don't know how to do is determine the active interfaces, routes, etc. from visual basic. I can do it from DOS, but I want to do it from VB. I am sure that there's some API or DLL that I should be using, but I can't seem to figure it out. So, how do I call the DOS command, "ROUTE" from visual basic?

Tekmaven Oct 10th, 2003 9:10 am
Re: DOS "ROUTE" command
 
Shell("C:\Path\to\app.exe")


All times are GMT -4. The time now is 9:30 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC